Skip to content

Commit

Permalink
add sorting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Primajin committed Nov 11, 2020
1 parent 9a7fcc5 commit 125df47
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/react/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const HelloMessage = ({name}) => {
}, [setGreeting]);

return (
<div onClick={onClick}>
<div data-attribute="yes" onClick={onClick}>
{greeting} {name}
</div>
);
Expand Down
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module.exports = {
extends: ['prettier'],
plugins: ['import', 'prettier', 'sort-imports-es6-autofix'],
env: {
node: true,
browser: true,
es6: true,
node: true,
},
extends: ['prettier'],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['import', 'prettier', 'sort-imports-es6-autofix'],
rules: {
'array-callback-return': 'error',
'block-scoped-var': 'error',
Expand Down Expand Up @@ -63,12 +63,13 @@ module.exports = {
'prettier/prettier': [
'error',
{
singleQuote: true,
arrowParens: 'avoid',
bracketSpacing: false,
singleQuote: true,
trailingComma: 'es5',
arrowParens: 'avoid',
},
],
'sort-keys': ['error', 'asc', {caseSensitive: false, natural: true}],
strict: 'off',
'sort-imports-es6-autofix/sort-imports-es6': [
'error',
Expand Down
22 changes: 12 additions & 10 deletions react.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
module.exports = {
extends: ['./index.js', 'prettier/react'],
plugins: ['react', 'react-hooks'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
version: 'detect',
},
},
plugins: ['react', 'react-hooks'],
rules: {
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
'react/jsx-boolean-value': 'error',
'react/jsx-key': 'error',
'react/jsx-no-duplicate-props': 'error',
'react/jsx-no-undef': 'error',
'react/jsx-sort-props': 'off',
'react/jsx-sort-default-props': 'error',
'react/jsx-sort-props': 'error',
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/no-array-index-key': 'error',
Expand All @@ -32,6 +26,14 @@ module.exports = {
'react/no-will-update-set-state': 'error',
'react/prop-types': 'error',
'react/react-in-jsx-scope': 'error',
'react/sort-prop-types': 'off',
'react/sort-comp': 'error',
'react/sort-prop-types': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react-hooks/rules-of-hooks': 'error',
},
settings: {
react: {
version: 'detect',
},
},
};

0 comments on commit 125df47

Please sign in to comment.