Skip to content

Commit 0aae603

Browse files
committed
fix(scripts/lint): don't filter out TS files from ESLint CLI args
1 parent 6d44817 commit 0aae603

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/scripts/__tests__/__snapshots__/lint.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ exports[`lint does not use built-in ignore with --ignore-path 1`] = `eslint --co
1818
1919
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 .`;
2020
21-
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`;
21+
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`;

src/scripts/__tests__/lint.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ cases(
7575
'--no-cache will disable caching': {
7676
args: ['--no-cache'],
7777
},
78-
'runs on given files, but only js files': {
78+
'runs on given files, but only js and ts files': {
7979
args: [
8080
'./src/index.js',
81+
'./src/index.ts',
8182
'./package.json',
8283
'./src/index.css',
83-
'./src/component.js',
84+
'./src/component.jsx',
85+
'./src/component.tsx',
8486
],
8587
},
8688
},

src/scripts/lint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if (filesGiven) {
4646
// we need to take all the flag-less arguments (the files that should be linted)
4747
// and filter out the ones that aren't js files. Otherwise json or css files
4848
// may be passed through
49-
args = args.filter(a => !parsedArgs._.includes(a) || /\.jsx?$/.test(a))
49+
args = args.filter(a => !parsedArgs._.includes(a) || /\.(j|t)sx?$/.test(a))
5050
}
5151

5252
const result = spawn.sync(

0 commit comments

Comments
 (0)