-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a5aff5
commit ef3303f
Showing
4 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
|
||
// Get the command line arguments | ||
const args = process.argv.slice(2); | ||
|
||
// Find the index of the --files argument | ||
const filesArgIndex = args.indexOf('--files'); | ||
|
||
// If --files is not found or there's no argument after it, print an error and exit | ||
if (filesArgIndex === -1 || filesArgIndex === args.length - 1) { | ||
console.error('Error: Expected --files argument followed by a comma-separated list of filenames'); | ||
process.exit(1); | ||
} | ||
|
||
// Get the filenames from the argument after --files, splitting on commas | ||
const filenames = args[filesArgIndex + 1].split(','); | ||
|
||
filenames.forEach(filename => { | ||
fs.readFile(filename, 'utf8', (err, fileContents) => { | ||
if (err) { | ||
console.error(`Failed to read file ${filename}: ${err}`); | ||
return; | ||
} | ||
|
||
try { | ||
// Try to parse the file contents as JSON | ||
JSON.parse(fileContents); | ||
} catch (parseErr) { | ||
const match = parseErr.message.match(/at position (\d+)/); | ||
if (match) { | ||
const position = parseInt(match[1], 10); | ||
const lines = fileContents.slice(0, position).split('\n'); | ||
const line = lines.length; | ||
const column = lines[lines.length - 1].length + 1; | ||
console.error(`Failed to parse file ${filename} as JSON at line ${line}, column ${column}: ${parseErr}`); | ||
} else { | ||
console.error(`Failed to parse file ${filename} as JSON: ${parseErr}`); | ||
} | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"filePath":"/home/eli/Github/eslint/Makefile.js","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[{"ruleId":"no-extra-semi","replacedBy":[]},{"ruleId":"no-mixed-spaces-and-tabs","replacedBy":[]},{"ruleId":"array-bracket-spacing","replacedBy":[]},{"ruleId":"arrow-parens","replacedBy":[]},{"ruleId":"arrow-spacing","replacedBy":[]},{"ruleId":"indent","replacedBy":[]},{"ruleId":"block-spacing","replacedBy":[]},{"ruleId":"brace-style","replacedBy":[]},{"ruleId":"comma-dangle","replacedBy":[]},{"ruleId":"comma-spacing","replacedBy":[]},{"ruleId":"comma-style","replacedBy":[]},{"ruleId":"computed-property-spacing","replacedBy":[]},{"ruleId":"dot-location","replacedBy":[]},{"ruleId":"eol-last","replacedBy":[]},{"ruleId":"func-call-spacing","replacedBy":[]},{"ruleId":"function-call-argument-newline","replacedBy":[]},{"ruleId":"function-paren-newline","replacedBy":[]},{"ruleId":"generator-star-spacing","replacedBy":[]},{"ruleId":"key-spacing","replacedBy":[]},{"ruleId":"keyword-spacing","replacedBy":[]},{"ruleId":"lines-around-comment","replacedBy":[]},{"ruleId":"max-len","replacedBy":[]},{"ruleId":"max-statements-per-line","replacedBy":[]},{"ruleId":"new-parens","replacedBy":[]},{"ruleId":"no-confusing-arrow","replacedBy":[]},{"ruleId":"no-floating-decimal","replacedBy":[]},{"ruleId":"no-multi-spaces","replacedBy":[]},{"ruleId":"no-multiple-empty-lines","replacedBy":[]},{"ruleId":"no-new-object","replacedBy":["no-object-constructor"]},{"ruleId":"no-tabs","replacedBy":[]},{"ruleId":"no-trailing-spaces","replacedBy":[]},{"ruleId":"no-whitespace-before-property","replacedBy":[]},{"ruleId":"object-curly-newline","replacedBy":[]},{"ruleId":"object-curly-spacing","replacedBy":[]},{"ruleId":"object-property-newline","replacedBy":[]},{"ruleId":"one-var-declaration-per-line","replacedBy":[]},{"ruleId":"operator-linebreak","replacedBy":[]},{"ruleId":"padding-line-between-statements","replacedBy":[]},{"ruleId":"quotes","replacedBy":[]},{"ruleId":"quote-props","replacedBy":[]},{"ruleId":"rest-spread-spacing","replacedBy":[]},{"ruleId":"semi","replacedBy":[]},{"ruleId":"semi-spacing","replacedBy":[]},{"ruleId":"semi-style","replacedBy":[]},{"ruleId":"space-before-blocks","replacedBy":[]},{"ruleId":"space-before-function-paren","replacedBy":[]},{"ruleId":"space-in-parens","replacedBy":[]},{"ruleId":"space-infix-ops","replacedBy":[]},{"ruleId":"space-unary-ops","replacedBy":[]},{"ruleId":"spaced-comment","replacedBy":[]},{"ruleId":"switch-colon-spacing","replacedBy":[]},{"ruleId":"template-curly-spacing","replacedBy":[]},{"ruleId":"template-tag-spacing","replacedBy":[]},{"ruleId":"wrap-iife","replacedBy":[]},{"ruleId":"yield-star-spacing","replacedBy":[]}]}] |