Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pr/new major #172

Merged
merged 3 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"browserslist": "^4.14.6",
"browserslist": "^4.14.7",
"chalk": "^4.1.0",
"concurrently": "^5.3.0",
"cosmiconfig": "^7.0.0",
"cross-env": "^7.0.2",
"cross-spawn": "^7.0.3",
"doctoc": "^1.4.0",
"eslint": "^7.12.1",
"eslint-config-kentcdodds": "^16.1.0",
"eslint": "^7.13.0",
"eslint-config-kentcdodds": "^17.0.0",
"eslint-config-prettier": "^6.15.0",
"glob": "^7.1.6",
"husky": "^4.3.0",
Expand All @@ -84,7 +84,7 @@
"rollup-plugin-terser": "^7.0.2",
"semver": "^7.3.2",
"which": "^2.0.2",
"yargs-parser": "^20.2.3"
"yargs-parser": "^20.2.4"
},
"eslintConfig": {
"extends": [
Expand Down
2 changes: 0 additions & 2 deletions src/__tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ Available Scripts:
lint
pre-commit
test
travis-after-success
travis-release
validate

Options:
Expand Down
2 changes: 1 addition & 1 deletion src/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const glob = require('glob')

const [executor, ignoredBin, script] = process.argv

if (script) {
if (script && script !== '--help' && script !== 'help') {
spawnScript()
} else {
const scriptsPath = path.join(__dirname, 'scripts/')
Expand Down
22 changes: 12 additions & 10 deletions src/scripts/__tests__/__snapshots__/lint.js.snap
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`lint --no-cache will disable caching 1`] = `eslint --config ./src/config/eslintrc.js --ignore-path ./src/config/eslintignore --no-cache .`;
exports[`lint --no-cache will disable caching 1`] = `eslint --config ./src/config/eslintrc.js --ext js,ts,tsx --ignore-path ./src/config/eslintignore --no-cache .`;

exports[`lint calls eslint CLI with default args 1`] = `eslint --config ./src/config/eslintrc.js --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;
exports[`lint calls eslint CLI with default args 1`] = `eslint --config ./src/config/eslintrc.js --ext js,ts,tsx --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;

exports[`lint does not use built-in config with .eslintrc file 1`] = `eslint --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;
exports[`lint does not use built-in config with .eslintrc file 1`] = `eslint --ext js,ts,tsx --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;

exports[`lint does not use built-in config with .eslintrc.js file 1`] = `eslint --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;
exports[`lint does not use built-in config with .eslintrc.js file 1`] = `eslint --ext js,ts,tsx --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;

exports[`lint does not use built-in config with --config 1`] = `eslint --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache --config ./custom-config.js .`;
exports[`lint does not use built-in config with --config 1`] = `eslint --ext js,ts,tsx --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache --config ./custom-config.js .`;

exports[`lint does not use built-in config with eslintConfig pkg prop 1`] = `eslint --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;
exports[`lint does not use built-in config with eslintConfig pkg prop 1`] = `eslint --ext js,ts,tsx --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;

exports[`lint does not use built-in ignore with .eslintignore file 1`] = `eslint --config ./src/config/eslintrc.js --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;
exports[`lint does not use built-in ignore with .eslintignore file 1`] = `eslint --config ./src/config/eslintrc.js --ext js,ts,tsx --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;

exports[`lint does not use built-in ignore with --ignore-path 1`] = `eslint --config ./src/config/eslintrc.js --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache --ignore-path ./my-ignore .`;
exports[`lint does not use built-in ignore with --ignore-path 1`] = `eslint --config ./src/config/eslintrc.js --ext js,ts,tsx --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache --ignore-path ./my-ignore .`;

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 .`;
exports[`lint does not use built-in ignore with eslintIgnore pkg prop 1`] = `eslint --config ./src/config/eslintrc.js --ext js,ts,tsx --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache .`;

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 ./src/index.js ./src/component.js`;
exports[`lint runs on given files, but only js files 1`] = `eslint --config ./src/config/eslintrc.js --ext js,ts,tsx --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache ./src/index.js ./src/thing.ts ./src/lib.tsx ./src/component.js`;

exports[`lint supports custom --ext 1`] = `eslint --config ./src/config/eslintrc.js --ignore-path ./src/config/eslintignore --cache --cache-location <PROJECT_ROOT>/node_modules/.cache/.eslintcache --ext js .`;
72 changes: 0 additions & 72 deletions src/scripts/__tests__/__snapshots__/travis-after-success.js.snap

This file was deleted.

5 changes: 5 additions & 0 deletions src/scripts/__tests__/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,16 @@ cases(
'--no-cache will disable caching': {
args: ['--no-cache'],
},
'supports custom --ext': {
args: ['--ext', 'js'],
},
'runs on given files, but only js files': {
args: [
'./src/index.js',
'./package.json',
'./src/index.css',
'./src/thing.ts',
'./src/lib.tsx',
'./src/component.js',
],
},
Expand Down
77 changes: 0 additions & 77 deletions src/scripts/__tests__/travis-after-success.js

This file was deleted.

10 changes: 8 additions & 2 deletions src/scripts/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const config = useBuiltinConfig
? ['--config', hereRelative('../config/eslintrc.js')]
: []

const defaultExtensions = 'js,ts,tsx'
const ext = args.includes('--ext') ? [] : ['--ext', defaultExtensions]
const extensions = (parsedArgs.ext || defaultExtensions).split(',')

const useBuiltinIgnore =
!args.includes('--ignore-path') &&
!hasFile('.eslintignore') &&
Expand All @@ -43,12 +47,14 @@ 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) || extensions.some(e => a.endsWith(e)),
)
}

const result = spawn.sync(
resolveBin('eslint'),
[...config, ...ignore, ...cache, ...args, ...filesToApply],
[...config, ...ext, ...ignore, ...cache, ...args, ...filesToApply],
{stdio: 'inherit'},
)

Expand Down
64 changes: 0 additions & 64 deletions src/scripts/travis-after-success.js

This file was deleted.

50 changes: 0 additions & 50 deletions src/scripts/travis-release.js

This file was deleted.