monkeeShark/packages/shared/.eslintrc.js

119 lines
3.4 KiB
JavaScript
Raw Permalink Normal View History

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'import'
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript'
],
rules: {
'indent': ['warn', 'tab', {
'SwitchCase': 1,
2022-09-10 18:34:41 +00:00
'MemberExpression': 1,
'flatTernaryExpressions': true,
'ArrayExpression': 'first',
'ObjectExpression': 'first',
}],
'eol-last': ['error', 'always'],
'semi': ['error', 'always'],
2022-07-02 14:01:13 +00:00
'semi-spacing': ['error', { 'before': false, 'after': true }],
'quotes': ['warn', 'single'],
'comma-dangle': ['warn', 'always-multiline'],
2022-09-17 18:27:08 +00:00
'comma-spacing': ['error', { 'before': false, 'after': true }],
'array-bracket-spacing': ['error', 'never'],
'keyword-spacing': ['error', {
'before': true,
'after': true,
}],
'key-spacing': ['error', {
'beforeColon': false,
'afterColon': true,
}],
2022-06-23 04:19:17 +00:00
'arrow-spacing': ['error', {
'before': true,
'after': true,
}],
'brace-style': ['error', '1tbs', {
'allowSingleLine': true,
}],
2022-06-23 04:19:17 +00:00
'padded-blocks': ['error', 'never'],
/* TODO: path alias使warn
'no-restricted-imports': ['warn', {
'patterns': [
]
}],
*/
2022-01-31 12:29:08 +00:00
'eqeqeq': ['error', 'always', { 'null': 'ignore' }],
'no-multi-spaces': ['error'],
'no-var': ['error'],
'prefer-arrow-callback': ['error'],
'no-throw-literal': ['error'],
'no-param-reassign': ['warn'],
'no-constant-condition': ['warn'],
'no-empty-pattern': ['warn'],
'no-async-promise-executor': ['off'],
'no-useless-escape': ['off'],
'no-multiple-empty-lines': ['error', { 'max': 1 }],
'no-control-regex': ['warn'],
'no-empty': ['warn'],
'no-inner-declarations': ['off'],
'no-sparse-arrays': ['off'],
'nonblock-statement-body-position': ['error', 'beside'],
'object-curly-spacing': ['error', 'always'],
'space-infix-ops': ['error'],
'space-before-blocks': ['error', 'always'],
2023-10-29 04:07:49 +00:00
'padding-line-between-statements': [
'error',
{ 'blankLine': 'always', 'prev': 'function', 'next': '*' },
{ 'blankLine': 'always', 'prev': '*', 'next': 'function' },
],
2023-10-30 10:38:27 +00:00
"lines-between-class-members": "off",
2023-10-31 11:14:36 +00:00
/* typescript-eslint enforce
2023-10-30 10:38:27 +00:00
'@typescript-eslint/lines-between-class-members': ['error', {
2023-10-30 08:31:49 +00:00
enforce: [{
blankLine: 'always',
prev: 'method',
next: '*',
}]
}],
2023-10-31 11:14:36 +00:00
*/
2023-09-19 00:44:05 +00:00
'@typescript-eslint/func-call-spacing': ['error', 'never'],
'@typescript-eslint/no-explicit-any': ['warn'],
'@typescript-eslint/no-unused-vars': ['warn'],
2022-01-31 12:34:47 +00:00
'@typescript-eslint/no-unnecessary-condition': ['warn'],
'@typescript-eslint/no-var-requires': ['warn'],
'@typescript-eslint/no-inferrable-types': ['warn'],
'@typescript-eslint/no-empty-function': ['off'],
'@typescript-eslint/no-non-null-assertion': ['warn'],
2023-09-18 04:26:43 +00:00
'@typescript-eslint/explicit-function-return-type': ['off'],
'@typescript-eslint/no-misused-promises': ['error', {
'checksVoidReturn': false,
}],
2022-09-20 20:33:11 +00:00
'@typescript-eslint/consistent-type-imports': 'off',
2022-09-17 18:27:08 +00:00
'@typescript-eslint/prefer-nullish-coalescing': [
'warn',
2022-09-17 18:27:08 +00:00
],
'@typescript-eslint/naming-convention': [
'error',
{
"selector": "typeLike",
"format": ["PascalCase"]
},
{
"selector": "typeParameter",
"format": []
}
],
'import/no-unresolved': ['off'],
'import/no-default-export': ['warn'],
'import/order': ['warn', {
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
}]
},
};