Skip to content

Commit

Permalink
feat: Support ESLint 7.x
Browse files Browse the repository at this point in the history
Co-authored-by: Michaël De Boey <info@michaeldeboey.be>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
  • Loading branch information
MichaelDeBoey and ljharb committed May 17, 2020
1 parent 6d1c78d commit b4a5376
Show file tree
Hide file tree
Showing 6 changed files with 1,116 additions and 1,087 deletions.
94 changes: 67 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,94 @@
language: node_js
node_js:
- '12'
- '10'
- '8'
- '6'
# eslint 7: node 10+
# jest 26: node 10+
- 14
- 12
- 10
install:
- 'yarn add "eslint@${ESLINT}" "jest@${JEST}" "babel-jest@${JEST}"'
- 'yarn'
- 'yarn add "eslint@${ESLINT}" "jest@${JEST}" "babel-jest@${JEST}" --ignore-engines'
- 'if [ "${ESLINT-}" = 4 ]; then yarn add eslint-config-airbnb-base@13 --ignore-engines; fi'
- 'yarn --ignore-engines'
env:
- 'ESLINT=4 JEST=21'
- 'ESLINT=5 JEST=21'
- 'ESLINT=6 JEST=21'
- 'ESLINT=7 JEST=21'
- 'ESLINT=4 JEST=22'
- 'ESLINT=5 JEST=22'
- 'ESLINT=6 JEST=22'
- 'ESLINT=7 JEST=22'
- 'ESLINT=4 JEST=23'
- 'ESLINT=5 JEST=23'
- 'ESLINT=6 JEST=23'
- 'ESLINT=7 JEST=23'
- 'ESLINT=4 JEST=24'
- 'ESLINT=5 JEST=24'
- 'ESLINT=6 JEST=24'
- 'ESLINT=7 JEST=24'
- 'ESLINT=4 JEST=25'
- 'ESLINT=5 JEST=25'
- 'ESLINT=6 JEST=25'
- 'ESLINT=7 JEST=25'
- 'ESLINT=4 JEST=26'
- 'ESLINT=5 JEST=26'
- 'ESLINT=6 JEST=26'
- 'ESLINT=7 JEST=26'
matrix:
exclude:
# exclude eslint 6 on node 6
# jest 21: 4+
# jest 22: 6+
# jest 25: 8+
include:
# eslint 4, node 4/6/8
- node_js: '4'
env: 'ESLINT=4 JEST=21'
- node_js: '6'
env: 'ESLINT=6 JEST=24'
- node_js: '6'
env: 'ESLINT=6 JEST=25'
# exclude jest 25 on node 6
env: 'ESLINT=4 JEST=21'
- node_js: '8'
env: 'ESLINT=4 JEST=21'
- node_js: '6'
env: 'ESLINT=4 JEST=25'
env: 'ESLINT=4 JEST=22'
- node_js: '8'
env: 'ESLINT=4 JEST=22'
- node_js: '6'
env: 'ESLINT=5 JEST=25'
env: 'ESLINT=4 JEST=23'
- node_js: '8'
env: 'ESLINT=4 JEST=23'
- node_js: '6'
env: 'ESLINT=6 JEST=25'
# exclude jest 25 on node 8
env: 'ESLINT=4 JEST=24'
- node_js: '8'
env: 'ESLINT=4 JEST=25'
env: 'ESLINT=4 JEST=24'
- node_js: '8'
env: 'ESLINT=5 JEST=25'
env: 'ESLINT=4 JEST=25'

# eslint 5, node 6/8
- node_js: '6'
env: 'ESLINT=5 JEST=21'
- node_js: '8'
env: 'ESLINT=6 JEST=25'
# exclude jest 26 on node 6
env: 'ESLINT=5 JEST=21'
- node_js: '6'
env: 'ESLINT=4 JEST=26'
env: 'ESLINT=5 JEST=22'
- node_js: '8'
env: 'ESLINT=5 JEST=22'
- node_js: '6'
env: 'ESLINT=5 JEST=26'
env: 'ESLINT=5 JEST=23'
- node_js: '8'
env: 'ESLINT=5 JEST=23'
- node_js: '6'
env: 'ESLINT=6 JEST=26'
# exclude jest 26 on node 8
env: 'ESLINT=5 JEST=24'
- node_js: '8'
env: 'ESLINT=5 JEST=24'
- node_js: '8'
env: 'ESLINT=4 JEST=26'
env: 'ESLINT=5 JEST=25'

# eslint 6, node 8
- node_js: '8'
env: 'ESLINT=5 JEST=26'
env: 'ESLINT=6 JEST=21'
- node_js: '8'
env: 'ESLINT=6 JEST=26'
env: 'ESLINT=6 JEST=22'
- node_js: '8'
env: 'ESLINT=6 JEST=23'
- node_js: '8'
env: 'ESLINT=6 JEST=24'
- node_js: '8'
env: 'ESLINT=6 JEST=25'
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
projects: [
{
displayName: 'e2e',
testEnvironment: 'node',
testPathIgnorePatterns: [
'/examples/',
'/node_modules/',
Expand All @@ -21,10 +22,12 @@ module.exports = {
},
{
displayName: 'tests',
testEnvironment: 'node',
testMatch: ['<rootDir>/src/**/__tests__/**/*.js'],
},
{
displayName: 'lint',
testEnvironment: 'node',
runner: './',
testPathIgnorePatterns: [
'/examples/',
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@
"chalk": "^2.4.1",
"cosmiconfig": "^5.0.0",
"create-jest-runner": "^0.5.3",
"eslint": "^4.0.0 || ^5.0.0 || ^6.0.0"
"eslint": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
},
"devDependencies": {
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.0",
"@babel/preset-env": "~7.7.0",
"babel-jest": "^25.1.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.6.4",
"eslint-plugin-prettier": "^3.1.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-prettier": "^3.1.3",
"execa": "^1.0.0",
"jest": "^21.0.0 || ^22.0.0 || ^23.0.0 || ^24.0.0 || ^25.1.0 || ^26.0.0",
"jest-watch-select-projects": "^0.1.1",
Expand All @@ -47,7 +47,7 @@
"rimraf": "^2.6.2"
},
"peerDependencies": {
"eslint": "^4.0.0 || ^5.0.0 || ^6.0.0",
"eslint": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
"jest": "^21.0.0 || ^22.0.0 || ^23.0.0 || ^24.0.0 || ^25.1.0 || ^26.0.0"
},
"prettier": {
Expand Down
10 changes: 6 additions & 4 deletions src/utils/normalizeConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,18 @@ const normalizeCliOptions = rawConfig =>

const value = rawConfig[key] !== undefined ? rawConfig[key] : defaultValue;

return Object.assign({}, config, {
return {
...config,
[name]: transform(value),
});
};
}, {});
/* eslint-enable no-param-reassign */

const normalizeConfig = config => {
return Object.assign({}, config, {
return {
...config,
cliOptions: normalizeCliOptions(config.cliOptions || {}),
});
};
};

module.exports = normalizeConfig;
2 changes: 1 addition & 1 deletion src/watchFixPlugin/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('watchFixPlugin', () => {
beforeEach(() => {
jest.resetModules();
configOverrides = require('../../utils/configOverrides');
WatchFixPlugin = require('../');
WatchFixPlugin = require('..');
});

it('shows the correct prompt', async () => {
Expand Down

0 comments on commit b4a5376

Please sign in to comment.