Skip to content

Commit

Permalink
Lint: replace @adeira/eslint-runner with jest-runner-eslint
Browse files Browse the repository at this point in the history
I would like to propose replacing `@adeira/eslint-runner` with `jest-runner-eslint` which seems to be objectively better while doing basically the same. This proposal is part of the effort to make Universe setup simpler and generally better.

There is one noticeable change: I am using [`--changedSince=origin/master^`](https://jestjs.io/docs/cli#--changedsince) from Jest to lint only changed files. This technically means that we might lint more files than strictly needed. But I thought that won't hurt very much.

In case this proposal will be accepted I will deprecate `@adeira/eslint-runner` on NPM and recommend `jest-runner-eslint` instead.
  • Loading branch information
mrtnzlml authored and kodiakhq[bot] committed Apr 6, 2021
1 parent 2cd7530 commit 3903496
Show file tree
Hide file tree
Showing 24 changed files with 35 additions and 834 deletions.
3 changes: 1 addition & 2 deletions .jest-eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ module.exports = {
displayName: 'lint',
rootDir: __dirname,
verbose: false,
reporters: ['@adeira/eslint-runner/reporter'],
runner: '@adeira/eslint-runner',
runner: 'jest-runner-eslint',
testMatch: ['<rootDir>/src/**/*.js', '<rootDir>/scripts/**/*.js'],
testPathIgnorePatterns: [
'/node_modules/',
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"devDependencies": {
"@adeira/babel-preset-adeira": "^3.0.0",
"@adeira/eslint-config": "^5.3.0",
"@adeira/eslint-runner": "^2.0.0",
"@babel/cli": "^7.13.14",
"@babel/core": "^7.13.14",
"babel-eslint": "^10.1.0",
Expand All @@ -20,7 +19,8 @@
"eslint": "^7.23.0",
"flow-bin": "^0.148.0",
"glob": "^7.1.6",
"jest": "^26.6.3"
"jest": "^26.6.3",
"jest-runner-eslint": "^0.10.0"
},
"jest": {
"testRegex": "/scripts/jest/dontRunJestDirectly\\.js$"
Expand All @@ -29,9 +29,15 @@
"//": [
"Please do not add new scripts here. Use scripts section in your workspace instead."
],
"lint": "yarn run eslint-config-prettier src/js/src/invariant.js && yarn run prettier --check \"src/**/*.md\" && yarn run jest --config=.jest-eslint.config.js",
"lint": "yarn run eslint-config-prettier src/js/src/invariant.js && yarn run prettier --check \"src/**/*.md\" && yarn run jest --config=.jest-eslint.config.js --changedSince=origin/master^",
"scanner": "yarn run jest --config src/monorepo-scanner/.jest.config.js",
"test": "yarn run flow && yarn run lint && yarn run test-only --ci --colors && yarn run scanner",
"test-only": "src/monorepo-utils/bin/monorepo-run-tests.js"
},
"jest-runner-eslint": {
"cliOptions": {
"format": "codeframe",
"reportUnusedDisableDirectives": true
}
}
}
1 change: 0 additions & 1 deletion scripts/publishedPackages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"@adeira/css-colors",
"@adeira/eslint-config",
"@adeira/eslint-fixtures-tester",
"@adeira/eslint-runner",
"@adeira/fetch",
"@adeira/fixtures-tester",
"@adeira/flow-config-parser",
Expand Down
25 changes: 0 additions & 25 deletions src/eslint-config-adeira/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,6 @@ It is important to report any issues with the eslint configuration back so we ca

Also please note that **you should not ignore Eslint warnings**! These warnings are helping you to migrate to the future major version. Some of them will turn into errors in the next major version bump.

# Custom Eslint Runner

Custom Eslint Runner was moved to a different package so you can use it independently, see: [@adeira/eslint-runner](https://github.com/adeira/universe/tree/master/src/eslint-runner)

## Tip

You can benefit from the main Jest executor much more. You can for example use watch mode to watch changes in one directory:

```text
yarn run lint src/packages/relay --watch [--all]
```

Basically, every Jest watch option is available:

```text
Watch Usage
› Press a to run all tests.
› Press f to run only failed tests.
› Press o to only run tests related to changed files.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press q to quit watch mode.
› Press Enter to trigger a test run.
```

# Prior art

- https://github.com/facebook/fbjs
Expand Down
3 changes: 0 additions & 3 deletions src/eslint-config-adeira/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,5 @@
},
"peerDependencies": {
"eslint": ">=7.14.0"
},
"optionalDependencies": {
"@adeira/eslint-runner": "^2.0.0"
}
}
3 changes: 0 additions & 3 deletions src/eslint-runner/.npmignore

This file was deleted.

11 changes: 0 additions & 11 deletions src/eslint-runner/BUILD.bazel

This file was deleted.

9 changes: 0 additions & 9 deletions src/eslint-runner/CHANGELOG.md

This file was deleted.

21 changes: 0 additions & 21 deletions src/eslint-runner/LICENSE

This file was deleted.

50 changes: 0 additions & 50 deletions src/eslint-runner/README.md

This file was deleted.

Binary file removed src/eslint-runner/codeframe-output.png
Binary file not shown.
18 changes: 0 additions & 18 deletions src/eslint-runner/index.js

This file was deleted.

25 changes: 0 additions & 25 deletions src/eslint-runner/package.json

This file was deleted.

94 changes: 0 additions & 94 deletions src/eslint-runner/reporter.js

This file was deleted.

13 changes: 0 additions & 13 deletions src/eslint-runner/src/.eslintrc.js

This file was deleted.

Loading

0 comments on commit 3903496

Please sign in to comment.