Skip to content

Commit

Permalink
feat(react): add react style warn, fix object spread change breaking …
Browse files Browse the repository at this point in the history
…VSCode (#15)

VSCode is still using Node 7.9 😭
  • Loading branch information
DHedgecock committed Jul 19, 2018
1 parent 6648fad commit e76faff
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 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:8.9.3-alpine
FROM node:7.9-alpine

WORKDIR /usr/src/app

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

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',
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'
},

// 🌍 Environment adjustments
// ---------------------------------------------------------------------------
Expand All @@ -67,7 +73,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 @@ -79,19 +85,25 @@ module.exports = {

// These rules are non critical, stylistic rules, warn only in dev for them
'arrow-body-style': 'warn',
'class-methods-use-this': 'warn',
'no-unused-vars': 'warn',
'prefer-const': 'warn',
'prefer-destructuring': 'warn',

'react/default-props-match-prop-types': 'warn',
'react/destructuring-assignment': 'warn',
'react/forbid-prop-types': 'warn',
'react/jsx-boolean-value': 'warn',
'react/no-multi-comp': 'warn',
'react/no-unescaped-entities': 'warn',
'react/no-unused-prop-types': 'warn',
'react/no-unused-state': 'warn',
'react/prefer-stateless-function': 'warn',
'react/prop-types': 'warn',
'react/require-default-props': 'warn',
'react/self-closing-comp': 'warn',

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

0 comments on commit e76faff

Please sign in to comment.