Skip to content

Commit

Permalink
Some config changes
Browse files Browse the repository at this point in the history
  • Loading branch information
burtek committed Nov 21, 2021
1 parent 8606e26 commit f402aec
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 23 deletions.
21 changes: 6 additions & 15 deletions eslint-config-base.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const makeNamingRules = require('./helpers/make-naming-config');

// need no-splice-add and no-splice-remove

module.exports = {
extends: [
'plugin:@typescript-eslint/eslint-recommended',
Expand Down Expand Up @@ -213,17 +215,6 @@ module.exports = {
}]
}
},
{
files: ['*.jsx', '*.tsx'],
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
rules: {
'jsx-quotes': ['error', 'prefer-single']
}
},
{
files: ['*.test.js', '*.test.jsx', '*.test.ts', '*.test.tsx'],
extends: [
Expand Down Expand Up @@ -415,7 +406,7 @@ module.exports = {
'no-array-constructor': 'error',
'no-continue': 'error',
'no-lonely-if': 'error',
'no-mixed-operators': 'error',
'no-mixed-operators': 'off', // need to make better config or make own custom rule
'no-multi-assign': 'error',
'no-multiple-empty-lines': ['error', {
'max': 2
Expand Down Expand Up @@ -510,9 +501,9 @@ module.exports = {
'import/no-self-import': 'error',
'import/order': ['error', {
'groups': [
['builtin', 'external'],
'parent',
'sibling',
'builtin',
'external',
['parent', 'sibling'],
'index'
],
'newlines-between': 'never',
Expand Down
25 changes: 19 additions & 6 deletions eslint-config-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
linkComponents: linkComponents
},
rules: {
'react/button-has-type': 'error',
'react/button-has-type': 'warn',
'react/display-name': 'error',
'react/no-access-state-in-setstate': 'error',
'react/no-array-index-key': 'error',
Expand Down Expand Up @@ -68,6 +68,17 @@ module.exports = {
'@typescript-eslint/naming-convention': makeNamingRules({ isReact: true })
}
},
{
files: ['*.jsx', '*.tsx'],
parserOptions: {
ecmaFeatures: {
jsx: true
}
},
rules: {
'jsx-quotes': ['error', 'prefer-double']
}
},
{
files: ['*.jsx', '*.tsx'],
rules: {
Expand All @@ -88,7 +99,7 @@ module.exports = {
}],
'react/jsx-equals-spacing': 'error',
'react/jsx-first-prop-new-line': 'error',
'react/jsx-fragments': ['error', 'element'],
'react/jsx-fragments': ['error', 'syntax'],
'react/jsx-handler-names': ['error', {
'checkInlineFunction': true
}],
Expand All @@ -101,7 +112,12 @@ module.exports = {
'checkFragmentShorthand': true,
'checkKeyMustBeforeSpread': true
}],
'react/jsx-max-props-per-line': 'error',
'react/jsx-max-props-per-line': ["error", {
"maximum": {
"single": 2,
"multi": 1
}
}],
'react/jsx-no-bind': 'error',
'react/jsx-no-comment-textnodes': 'error',
'react/jsx-no-constructed-context-values': 'error',
Expand All @@ -113,9 +129,6 @@ module.exports = {
})],
'react/jsx-no-target-blank': 'error',
'react/jsx-no-useless-fragment': 'error',
'react/jsx-one-expression-per-line': ['error', {
'allow': 'literal'
}],
'react/jsx-pascal-case': 'error',
'react/jsx-tag-spacing': 'error',
'react/jsx-wrap-multilines': ['error', {
Expand Down
9 changes: 7 additions & 2 deletions helpers/make-naming-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@ const configs = [
];
const reactConfigs = [
{
// const global variables of function type can be PascalCase for React Components
// React Components
'selector': 'variable',
'modifiers': ['const', 'global'],
'types': ['function'],
'format': ['camelCase', 'UPPER_CASE', 'PascalCase']
},
{
// React Components
'selector': 'function',
'format': ['camelCase', 'PascalCase']
},
{
// Components passed as props
'selector': 'property',
'selector': 'parameter',
'filter': 'Comp(onent)?$',
'format': ['camelCase', 'PascalCase']
},
Expand Down

0 comments on commit f402aec

Please sign in to comment.