mirror of
https://github.com/desktop/desktop
synced 2024-08-27 04:00:55 +00:00
pull eslint into yarn scripts
This commit is contained in:
parent
483d4ae3b7
commit
1b6bc7cfcd
|
@ -4,7 +4,6 @@ plugins:
|
|||
- typescript
|
||||
- babel
|
||||
- react
|
||||
- prettier
|
||||
- json
|
||||
|
||||
extends:
|
||||
|
@ -73,9 +72,6 @@ rules:
|
|||
###########
|
||||
# SPECIAL #
|
||||
###########
|
||||
prettier/prettier:
|
||||
- error
|
||||
- parser: typescript
|
||||
no-restricted-syntax:
|
||||
- error
|
||||
# no-default-export
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"lint:src": "yarn tslint && yarn eslint-check && yarn eslint",
|
||||
"lint:src:fix": "yarn tslint --fix && yarn eslint --fix",
|
||||
"tslint": "tslint -p .",
|
||||
"eslint": "ts-node -P script/tsconfig.json script/eslint.ts",
|
||||
"eslint": "eslint --cache --rulesdir ./eslint-rules \"./{script,eslint-rules,tslint-rules}/**/*.{j,t}s{,x}\" \"./app/{src,typings,test}/**/*.{j,t}s{,x}\" \"./changelog.json\"",
|
||||
"eslint-check": "eslint --print-config .eslintrc.* | eslint-config-prettier-check",
|
||||
"publish": "ts-node -P script/tsconfig.json script/publish.ts",
|
||||
"clean-slate": "rimraf out node_modules app/node_modules coverage && yarn",
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
#!/usr/bin/env ts-node
|
||||
|
||||
import * as Path from 'path'
|
||||
import chalk from 'chalk'
|
||||
|
||||
const { CLIEngine } = require('eslint')
|
||||
|
||||
const shouldFix = process.argv.indexOf('--fix') > -1
|
||||
const eslint = new CLIEngine({
|
||||
cache: true,
|
||||
cwd: Path.dirname(__dirname),
|
||||
fix: shouldFix,
|
||||
rulePaths: [Path.join(__dirname, '..', 'eslint-rules')],
|
||||
})
|
||||
|
||||
const report = eslint.executeOnFiles([
|
||||
'./{script,eslint-rules}/**/*.{j,t}s?(x)',
|
||||
'./tslint-rules/**/*.ts',
|
||||
'./app/*.ts',
|
||||
'./app/{src,typings,test}/**/*.{j,t}s?(x)',
|
||||
'./changelog.json',
|
||||
])
|
||||
|
||||
if (shouldFix) {
|
||||
CLIEngine.outputFixes(report)
|
||||
}
|
||||
|
||||
console.log(eslint.getFormatter()(report.results))
|
||||
|
||||
if (report.errorCount > 0) {
|
||||
process.exitCode = 1
|
||||
console.error(
|
||||
chalk`{bold.green → To fix some of these errors, run {underline yarn eslint --fix}}`
|
||||
)
|
||||
}
|
Loading…
Reference in a new issue