53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import type { EslintRulesObject } from '@aet/eslint-define-config/src/rules/eslint';
|
|
|
|
import { error, off, warn } from '../constants';
|
|
|
|
import restrictedGlobals from './_restrictedGlobals.json';
|
|
|
|
export const eslintRules: Partial<EslintRulesObject> = {
|
|
'arrow-body-style': [error, 'as-needed'],
|
|
'class-methods-use-this': warn,
|
|
'func-style': [error, 'declaration', { allowArrowFunctions: true }],
|
|
'no-async-promise-executor': off,
|
|
'no-case-declarations': off,
|
|
'no-console': warn,
|
|
'no-constant-condition': [error, { checkLoops: false }],
|
|
'no-debugger': warn,
|
|
'no-duplicate-imports': off,
|
|
'no-empty': [error, { allowEmptyCatch: true }],
|
|
'no-inner-declarations': off,
|
|
'no-lonely-if': error,
|
|
'no-restricted-globals': [error, ...restrictedGlobals],
|
|
'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', const: '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 }],
|
|
complexity: [warn, { max: 100 }],
|
|
curly: [error, 'multi-line', 'consistent'],
|
|
eqeqeq: [error, 'smart'],
|
|
yoda: [error, 'never', { exceptRange: true }],
|
|
};
|