update to latests
This commit is contained in:
parent
71c67f66de
commit
af0c093759
19 changed files with 2194 additions and 1018 deletions
16
src/base/overrides.js
Normal file
16
src/base/overrides.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
module.exports = [
|
||||
{
|
||||
files: ["*.test.ts"],
|
||||
rules: {
|
||||
"require-atomic-updates": "off", // tests do this a lot
|
||||
"no-underscore-dangle": "off", // allow testing private methods
|
||||
"@typescript-eslint/no-empty-function": "off", // allow empty functions in tests, often used in mock implementations
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["*.js", "prettier.config.js"],
|
||||
rules: {
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
},
|
||||
},
|
||||
];
|
|
@ -1,8 +1,12 @@
|
|||
module.exports = {
|
||||
// === DISABLED ===
|
||||
// ==== ERRORS ====
|
||||
curly: 'error',
|
||||
'sort-imports': ['error', {
|
||||
ignoreDeclarationSort: true
|
||||
}],
|
||||
curly: "error",
|
||||
"sort-imports": [
|
||||
"error",
|
||||
{
|
||||
ignoreDeclarationSort: true,
|
||||
},
|
||||
],
|
||||
"no-underscore-dangle": ["error", { allowAfterThis: true }], // using underscores as an alternative to mark methods as private. This way we can still write tests for methods
|
||||
};
|
||||
|
|
7
src/base/rules/filenames.js
Normal file
7
src/base/rules/filenames.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
// === DISABLED ===
|
||||
"filenames/no-index": "off",
|
||||
"filenames/match-exported": "off",
|
||||
// ==== ERRORS ====
|
||||
"filenames/match-regex": ["error", "kebab"],
|
||||
};
|
|
@ -1,18 +1,18 @@
|
|||
module.exports = {
|
||||
// === DISABLED ===
|
||||
// recommended is error, typescript covers this and import/named error has issues
|
||||
'import/named': 'off',
|
||||
"import/named": "off",
|
||||
// on by default, we do NOT want export default ever.
|
||||
'import/default': 'off',
|
||||
"import/default": "off",
|
||||
// ==== ERRORS ====
|
||||
// We will not use plugin:import/warnings because we want errors
|
||||
'import/no-duplicates': 'error',
|
||||
'import/order': ['error', { 'newlines-between': 'always' }],
|
||||
"import/no-duplicates": "error",
|
||||
"import/order": ["error", { "newlines-between": "always" }],
|
||||
// This will differ for every project and may not even need any settings
|
||||
// COPY this to rules of project:
|
||||
// `"import/no-internal-modules": ["error", { allow: ["uuid/**", "@nestjs/**"] }],`
|
||||
'import/no-internal-modules': ['error'],
|
||||
'import/no-cycle': 'error',
|
||||
'import/no-mutable-exports': 'error',
|
||||
'import/no-default-export': 'error',
|
||||
"import/no-internal-modules": ["error"],
|
||||
"import/no-cycle": "error",
|
||||
"import/no-mutable-exports": "error",
|
||||
"import/no-default-export": "error",
|
||||
};
|
||||
|
|
|
@ -2,5 +2,5 @@ module.exports = {
|
|||
// === DISABLED ===
|
||||
// ==== ERRORS ====
|
||||
// recommended is warn => enforcing error
|
||||
'new-with-error/new-with-error': 'error',
|
||||
"new-with-error/new-with-error": "error",
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
// === DISABLED ===
|
||||
// ==== ERRORS ====
|
||||
'prettier/prettier': 'error',
|
||||
"prettier/prettier": "error",
|
||||
};
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
module.exports = {
|
||||
// === DISABLED ===
|
||||
// We like parameter properties, so turn them on by turning off this default inverse rule.
|
||||
'@typescript-eslint/no-parameter-properties': 'off',
|
||||
"@typescript-eslint/no-parameter-properties": "off",
|
||||
// ==== ERRORS ====
|
||||
// recommended is warn => enforcing error
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
"@typescript-eslint/no-unused-vars": "error",
|
||||
// recommended is warn => enforcing error
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
// recommended is warn => enforcing error
|
||||
'@typescript-eslint/explicit-function-return-type': ['error', {
|
||||
allowExpressions: true,
|
||||
allowTypedFunctionExpressions: true
|
||||
}],
|
||||
"@typescript-eslint/explicit-function-return-type": [
|
||||
"error",
|
||||
{
|
||||
allowExpressions: true,
|
||||
allowTypedFunctionExpressions: true,
|
||||
},
|
||||
],
|
||||
// recommended does not configure no-public
|
||||
'@typescript-eslint/explicit-member-accessibility': ['error', {
|
||||
accessibility: 'no-public',
|
||||
}],
|
||||
'@typescript-eslint/no-extraneous-class': 'error',
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"error",
|
||||
{
|
||||
accessibility: "no-public",
|
||||
},
|
||||
],
|
||||
"@typescript-eslint/no-extraneous-class": "error",
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module.exports = {
|
||||
'import/parsers': {
|
||||
'@typescript-eslint/parser': ['.ts', '.tsx']
|
||||
"import/parsers": {
|
||||
"@typescript-eslint/parser": [".ts", ".tsx"],
|
||||
},
|
||||
'import/resolver': {
|
||||
"import/resolver": {
|
||||
typescript: {
|
||||
alwaysTryTypes: false,
|
||||
},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
base: require('../base'),
|
||||
react: require('../react'),
|
||||
prettierConfig: require('./prettier'),
|
||||
}
|
||||
base: require("../base"),
|
||||
react: require("../react"),
|
||||
prettierConfig: require("./prettier"),
|
||||
};
|
||||
|
|
|
@ -5,8 +5,8 @@ module.exports = {
|
|||
useTabs: false,
|
||||
semi: true,
|
||||
singleQuote: true,
|
||||
trailingComma: 'all',
|
||||
trailingComma: "all",
|
||||
bracketSpacing: true,
|
||||
jsxBracketSameLine: false,
|
||||
arrowParens: 'always',
|
||||
arrowParens: "always",
|
||||
};
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
module.exports = [
|
||||
{
|
||||
files: ['**/*.tsx'],
|
||||
files: ["**/*.tsx", "**/*.jsx"],
|
||||
rules: {
|
||||
// [Plugin] react - disable prop type checks in typescript since we use interfaces
|
||||
'react/prop-types': 'off',
|
||||
"react/prop-types": "off",
|
||||
|
||||
// Allow ts-ignore in test files for easily faking data and objects
|
||||
'@typescript-eslint/ban-ts-ignore': 'off',
|
||||
"@typescript-eslint/ban-ts-ignore": "off",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
4
src/react/rules/react-hooks.js
vendored
4
src/react/rules/react-hooks.js
vendored
|
@ -1,6 +1,6 @@
|
|||
module.exports = {
|
||||
// === DISABLED ===
|
||||
// ==== ERRORS ====
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'error',
|
||||
"react-hooks/rules-of-hooks": "error",
|
||||
"react-hooks/exhaustive-deps": "error",
|
||||
};
|
||||
|
|
39
src/react/rules/react.js
vendored
39
src/react/rules/react.js
vendored
|
@ -1,23 +1,26 @@
|
|||
module.exports = {
|
||||
// === DISABLED ===
|
||||
// This does not play nice with React.memo()
|
||||
'react/display-name': 'off',
|
||||
"react/display-name": "off",
|
||||
// ==== ERRORS ====
|
||||
'react/no-access-state-in-setstate': 'error',
|
||||
'react/no-redundant-should-component-update': 'error',
|
||||
'react/no-typos': 'error',
|
||||
'react/no-unsafe': 'error',
|
||||
'react/self-closing-comp': 'error',
|
||||
'react/jsx-no-bind': 'error',
|
||||
'react/jsx-max-depth': ['error', { max: 5 }],
|
||||
'react/jsx-curly-brace-presence': ['error', 'never'],
|
||||
'react/jsx-wrap-multilines': ['error', {
|
||||
declaration: 'parens-new-line',
|
||||
assignment: 'parens-new-line',
|
||||
return: 'parens-new-line',
|
||||
arrow: 'parens-new-line',
|
||||
condition: 'parens-new-line',
|
||||
logical: 'parens-new-line',
|
||||
prop: 'ignore',
|
||||
}],
|
||||
"react/no-access-state-in-setstate": "error",
|
||||
"react/no-redundant-should-component-update": "error",
|
||||
"react/no-typos": "error",
|
||||
"react/no-unsafe": "error",
|
||||
"react/self-closing-comp": "error",
|
||||
"react/jsx-no-bind": "error",
|
||||
"react/jsx-max-depth": ["error", { max: 5 }],
|
||||
"react/jsx-curly-brace-presence": ["error", "never"],
|
||||
"react/jsx-wrap-multilines": [
|
||||
"error",
|
||||
{
|
||||
declaration: "parens-new-line",
|
||||
assignment: "parens-new-line",
|
||||
return: "parens-new-line",
|
||||
arrow: "parens-new-line",
|
||||
condition: "parens-new-line",
|
||||
logical: "parens-new-line",
|
||||
prop: "ignore",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
4
src/react/settings/react.js
vendored
4
src/react/settings/react.js
vendored
|
@ -1,6 +1,6 @@
|
|||
module.exports = {
|
||||
react: {
|
||||
pragma: 'React',
|
||||
version: 'detect',
|
||||
pragma: "React",
|
||||
version: "detect",
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue