Refactor
This commit is contained in:
49
src/presets/eslint.ts
Normal file
49
src/presets/eslint.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import { error, warn, off } from '../index';
|
||||
import { EslintRules } from 'eslint-define-config/src/rules/eslint';
|
||||
|
||||
export const eslintRules: Partial<EslintRules> = {
|
||||
'arrow-body-style': [error, 'as-needed'],
|
||||
'class-methods-use-this': off,
|
||||
'no-async-promise-executor': off,
|
||||
'no-case-declarations': off,
|
||||
'no-console': warn,
|
||||
'no-constant-condition': [error, { checkLoops: false }],
|
||||
'no-debugger': warn,
|
||||
'no-duplicate-imports': error,
|
||||
'no-empty': [error, { allowEmptyCatch: true }],
|
||||
'no-inner-declarations': off,
|
||||
'no-lonely-if': error,
|
||||
'no-restricted-globals': [error, 'event', 'name', 'length'],
|
||||
'no-restricted-imports': [
|
||||
error,
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: 'crypto',
|
||||
importNames: ['webcrypto'],
|
||||
message: 'Use global `crypto` instead',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'no-template-curly-in-string': error,
|
||||
'no-var': error,
|
||||
'object-shorthand': [error, 'always', { ignoreConstructors: true }],
|
||||
'one-var': [error, { var: 'never', let: 'never' }],
|
||||
'prefer-arrow-callback': error,
|
||||
'prefer-const': [error, { destructuring: 'all' }],
|
||||
'prefer-destructuring': [
|
||||
warn,
|
||||
{ AssignmentExpression: { array: false, object: false } },
|
||||
],
|
||||
'prefer-object-spread': error,
|
||||
'prefer-rest-params': warn,
|
||||
'prefer-spread': warn,
|
||||
'quote-props': [error, 'as-needed'],
|
||||
'sort-imports': [warn, { ignoreDeclarationSort: true }],
|
||||
'spaced-comment': [error, 'always', { markers: ['/', '#', '@'] }],
|
||||
complexity: [warn, { max: 100 }],
|
||||
curly: [error, 'multi-line', 'consistent'],
|
||||
eqeqeq: [error, 'smart'],
|
||||
yoda: [error, 'never', { exceptRange: true }],
|
||||
};
|
Reference in New Issue
Block a user