Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Remove extra keys that are invalid in eslintrc (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliperelman authored Oct 13, 2017
1 parent 3d495a8 commit 62945b6
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
1 change: 0 additions & 1 deletion .neutrinorc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = {
'packages/neutrino/bin/*'
],
eslint: {
node: true,
envs: ['browser', 'commonjs', 'node'],
plugins: ['eslint-plugin-prettier'],
rules: {
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ install:
before_script:
- yarn bootstrap --frozen-lockfile
script:
- yarn validate:eslintrc
- yarn lint
- yarn test
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
"bugs": "https://github.com/mozilla-neutrino/neutrino-dev/issues",
"repository": "mozilla-neutrino/neutrino-dev",
"scripts": {
"validate:eslintrc:root": "eslint --no-eslintrc --print-config . -c ./.eslintrc.js > /dev/null",
"validate:eslintrc:eslint": "eslint --no-eslintrc --print-config . -c ./packages/neutrino-middleware-eslint/eslintrc.js > /dev/null",
"validate:eslintrc:airbnb-base": "eslint --no-eslintrc --print-config . -c ./packages/neutrino-preset-airbnb-base/eslintrc.js > /dev/null",
"validate:eslintrc": "yarn validate:eslintrc:eslint && yarn validate:eslintrc:airbnb-base && yarn validate:eslintrc:root",
"lint": "node packages/neutrino/bin/neutrino lint",
"bootstrap": "oao bootstrap --no-parallel",
"changelog": "changelog mozilla-neutrino/neutrino-dev all --markdown > CHANGELOG.md",
Expand Down Expand Up @@ -51,7 +55,11 @@
},
"lint-staged": {
"*.js": [
"packages/neutrino/bin/neutrino lint --fix",
"yarn lint --fix",
"git add"
],
"packages/neutrino/bin/neutrino": [
"yarn lint --fix",
"git add"
]
}
Expand Down
6 changes: 6 additions & 0 deletions packages/neutrino-middleware-eslint/eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { Neutrino } = require('../neutrino');

const api = Neutrino({ cwd: __dirname });

// eslint-disable-next-line global-require
module.exports = api.call('eslintrc', [require('.')]);
9 changes: 7 additions & 2 deletions packages/neutrino-middleware-eslint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ const reduceToTrueKeys = reduce((acc, key) => assoc(key, true, acc), {});
const getEslintRcConfig = pipe(
getEslintOptions,
clone,
assoc('useEslintrc', true),
omit(['failOnError', 'emitWarning', 'emitError']),
// We remove these keys since they are needed when running the lint command but
// not the eslintrc command. The lint command uses ESLint's CLIEngine, but the
// ESLint RC format does not match the CLIEngine format exactly. We must remove
// anything we add that does not comply with ESLint's schemas.
// https://github.com/eslint/eslint/blob/9d1df92628dd4dd1e70fbb19454008e146387435/conf/config-schema.js
// https://github.com/eslint/eslint/blob/9d1df92628dd4dd1e70fbb19454008e146387435/lib/config/config-validator.js#L167
omit(['failOnError', 'emitWarning', 'emitError', 'cwd', 'useEslintrc', 'fix', 'extensions']),
renameKeys({ envs: 'env', baseConfig: 'extends' }),
evolve({
extends: prop('extends'),
Expand Down
6 changes: 6 additions & 0 deletions packages/neutrino-preset-airbnb-base/eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { Neutrino } = require('../neutrino');

const api = Neutrino({ cwd: __dirname });

// eslint-disable-next-line global-require
module.exports = api.call('eslintrc', [require('.')]);

0 comments on commit 62945b6

Please sign in to comment.