Skip to content

Commit

Permalink
refactor: use object spread to merge environment rules
Browse files Browse the repository at this point in the history
Atom has updated to Node 8.9.3, allowing us to use object spread for object merging

BREAKING CHANGE:
Version 8.6+ of Node is now required
  • Loading branch information
Dan Hedgecock committed Jul 19, 2018
1 parent daff0ec commit 6648fad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Target node version should match the version used by Atom, this ensures that
# ESLint extensions in Atom can execute these settings
FROM node:7.9-alpine
FROM node:8.9.3-alpine

WORKDIR /usr/src/app

Expand Down
51 changes: 22 additions & 29 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,25 @@ module.exports = {
: { node: { extensions: ['.js', '.mjs', '.json'] } }
},

rules: Object.assign(
{
// --- 🌬 Flow
// See: https://github.com/gajus/eslint-plugin-flowtype
'flowtype/define-flow-type': 'warn',
'flowtype/require-valid-file-annotation': 'warn',
'flowtype/use-flow-type': 'warn',

// --- ⬆️ Updates/Enhancements
// Don't enforce .jsx file extension, it doesn't provide a clear benefit and
// often requires addl configs on other tooling, do less Β―\_(ツ)_/Β―
'react/jsx-filename-extension': 'off',
// Include .mjs file extension in list of file that shouldn't use ext
'import/extensions': [
'error',
'always',
{ js: 'never', jsx: 'never', mjs: 'never' }
],

// πŸ› Bugs
// ---------------------------------------------------------------------------

// Class ordering currently doesn't support class property syntax, which is πŸ™…
// Update on: https://github.com/yannickcr/eslint-plugin-react/pull/685
'react/sort-comp': 'off'
},
rules: {
// --- 🌬 Flow
// See: https://github.com/gajus/eslint-plugin-flowtype
'flowtype/define-flow-type': 'warn',
'flowtype/require-valid-file-annotation': 'warn',
'flowtype/use-flow-type': 'warn',

// --- ⬆️ Updates/Enhancements
// Don't enforce .jsx file extension, it doesn't provide a clear benefit and
// often requires addl configs on other tooling, do less Β―\_(ツ)_/Β―
'react/jsx-filename-extension': 'off',
// Include .mjs file extension in list of file that shouldn't use ext
'import/extensions': ['error', 'always', { js: 'never', jsx: 'never', mjs: 'never' }],

// --- πŸ› Bugs

// Class ordering currently doesn't support class property syntax, which is πŸ™…
// Update on: https://github.com/yannickcr/eslint-plugin-react/pull/685
'react/sort-comp': 'off',

// 🌍 Environment adjustments
// ---------------------------------------------------------------------------
Expand All @@ -74,7 +67,7 @@ module.exports = {
* (especially when using webpack dev server hooked into the errors overlay
* πŸ˜‰)
*/
NODE_ENV === 'test'
...(NODE_ENV === 'test'
? {
// Validate formatting is correct in test,prod,etc.
'prettier/prettier': 'error'
Expand All @@ -99,6 +92,6 @@ module.exports = {
'react/require-default-props': 'warn',

'import/first': 'warn'
}
)
})
}
}

0 comments on commit 6648fad

Please sign in to comment.