eslint-config/packages/typescript/index.js
CondorHero 5f05cfcfd6
fix: eslint-plugin-import support TypeScript (#77)
Co-authored-by: CondorHero <love2xinwei@gmail.com>
2022-03-31 22:19:07 +08:00

61 lines
2.5 KiB
JavaScript

// eslint-disable-next-line @typescript-eslint/no-var-requires
const basic = require('@antfu/eslint-config-basic')
module.exports = {
extends: [
'@antfu/eslint-config-basic',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
],
settings: {
'import/resolver': {
node: { extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.d.ts'] },
},
},
overrides: basic.overrides,
rules: {
'import/named': 'off',
// TS
'@typescript-eslint/semi': ['error', 'never'],
'@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }],
'@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],
'@typescript-eslint/type-annotation-spacing': ['error', {}],
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports', disallowTypeAnnotations: false }],
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
'@typescript-eslint/prefer-ts-expect-error': 'error',
// Override JS
'no-useless-constructor': 'off',
'indent': 'off',
'@typescript-eslint/indent': ['error', 2],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false, variables: true }],
'brace-style': 'off',
'@typescript-eslint/brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': ['error', 'always-multiline'],
'object-curly-spacing': 'off',
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
// off
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-namespace': 'off',
},
}