Skip to content

Commit

Permalink
fix(scripts/lint): don't filter out TS files from ESLint CLI args
Browse files Browse the repository at this point in the history
  • Loading branch information
jrolfs committed Mar 13, 2020
1 parent 6d44817 commit 0aae603
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/scripts/__tests__/__snapshots__/lint.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ exports[`lint does not use built-in ignore with --ignore-path 1`] = `eslint --co
exports[`lint does not use built-in ignore with eslintIgnore pkg prop 1`] = `eslint --config ./src/config/eslintrc.js --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache --ext .js,.jsx,.ts,.tsx .`;
exports[`lint runs on given files, but only js files 1`] = `eslint --config ./src/config/eslintrc.js --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache --ext .js,.jsx,.ts,.tsx ./src/index.js ./src/component.js`;
exports[`lint runs on given files, but only js and ts files 1`] = `eslint --config ./src/config/eslintrc.js --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache --ext .js,.jsx,.ts,.tsx ./src/index.js ./src/index.ts ./src/component.jsx ./src/component.tsx`;
6 changes: 4 additions & 2 deletions src/scripts/__tests__/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ cases(
'--no-cache will disable caching': {
args: ['--no-cache'],
},
'runs on given files, but only js files': {
'runs on given files, but only js and ts files': {
args: [
'./src/index.js',
'./src/index.ts',
'./package.json',
'./src/index.css',
'./src/component.js',
'./src/component.jsx',
'./src/component.tsx',
],
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (filesGiven) {
// we need to take all the flag-less arguments (the files that should be linted)
// and filter out the ones that aren't js files. Otherwise json or css files
// may be passed through
args = args.filter(a => !parsedArgs._.includes(a) || /\.jsx?$/.test(a))
args = args.filter(a => !parsedArgs._.includes(a) || /\.(j|t)sx?$/.test(a))
}

const result = spawn.sync(
Expand Down

0 comments on commit 0aae603

Please sign in to comment.