UNPKG

@perfective/eslint-config

Version:
141 lines 4.94 kB
import eslintPluginStylisticTs from '@stylistic/eslint-plugin-ts'; import { typescriptFiles } from "../../../linter/glob.js"; import { typescriptLanguageOptions } from "../../../linter/language-options.js"; export function stylisticTsConfig() { return { files: typescriptFiles, languageOptions: typescriptLanguageOptions(), plugins: { '@stylistic/ts': eslintPluginStylisticTs }, rules: { '@stylistic/js/block-spacing': 'off', '@stylistic/ts/block-spacing': ['warn', 'always'], '@stylistic/js/brace-style': 'off', '@stylistic/ts/brace-style': ['warn', 'stroustrup', { allowSingleLine: false }], '@stylistic/js/comma-dangle': 'off', '@stylistic/ts/comma-dangle': ['warn', { arrays: 'always-multiline', enums: 'always-multiline', exports: 'always-multiline', functions: 'always-multiline', generics: 'always-multiline', imports: 'always-multiline', objects: 'always-multiline', tuples: 'always-multiline' }], '@stylistic/js/comma-spacing': 'off', '@stylistic/ts/comma-spacing': ['warn', { before: false, after: true }], '@stylistic/js/func-call-spacing': 'off', '@stylistic/ts/func-call-spacing': 'off', '@stylistic/js/function-call-spacing': 'off', '@stylistic/ts/function-call-spacing': ['warn', 'never'], '@stylistic/js/indent': 'off', '@stylistic/ts/indent': ['warn', 4, { SwitchCase: 1, ignoredNodes: ['TSTypeParameterInstantiation'] }], '@stylistic/js/key-spacing': 'off', '@stylistic/ts/key-spacing': ['warn', { beforeColon: false, afterColon: true, mode: 'strict' }], '@stylistic/js/keyword-spacing': 'off', '@stylistic/ts/keyword-spacing': ['warn', { before: true, after: true }], '@stylistic/js/lines-around-comment': 'off', '@stylistic/ts/lines-around-comment': ['warn', { beforeBlockComment: true, afterBlockComment: false, beforeLineComment: false, afterLineComment: false, allowBlockStart: false, allowBlockEnd: false, allowObjectStart: false, allowObjectEnd: false, allowArrayStart: false, allowArrayEnd: false, allowClassStart: true, allowClassEnd: false, allowInterfaceStart: true, allowInterfaceEnd: true, allowTypeStart: true, allowTypeEnd: true }], '@stylistic/js/lines-between-class-members': 'off', '@stylistic/ts/lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true, exceptAfterOverload: true }], '@stylistic/ts/member-delimiter-style': ['warn', { multiline: { delimiter: 'semi', requireLast: true }, singleline: { delimiter: 'semi', requireLast: true }, multilineDetection: 'brackets' }], '@stylistic/js/no-extra-parens': 'off', '@stylistic/ts/no-extra-parens': ['warn', 'all', { ignoreJSX: 'all', nestedBinaryExpressions: false, enforceForArrowConditionals: false }], '@stylistic/js/no-extra-semi': 'off', '@stylistic/ts/no-extra-semi': 'warn', '@stylistic/js/object-curly-newline': 'off', '@stylistic/ts/object-curly-newline': ['warn', { ImportDeclaration: { multiline: true }, ExportDeclaration: { multiline: true } }], '@stylistic/js/object-curly-spacing': 'off', '@stylistic/ts/object-curly-spacing': ['warn', 'always', { arraysInObjects: true, objectsInObjects: true }], '@stylistic/js/object-property-newline': 'off', '@stylistic/ts/object-property-newline': ['warn', { allowAllPropertiesOnSameLine: true }], '@stylistic/js/padding-line-between-statements': 'off', '@stylistic/ts/padding-line-between-statements': 'off', '@stylistic/js/quote-props': 'off', '@stylistic/ts/quote-props': ['warn', 'consistent-as-needed'], '@stylistic/js/quotes': 'off', '@stylistic/ts/quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }], '@stylistic/js/semi': 'off', '@stylistic/ts/semi': ['warn', 'always'], '@stylistic/js/space-before-blocks': 'off', '@stylistic/ts/space-before-blocks': ['warn', 'always'], '@stylistic/js/space-before-function-paren': 'off', '@stylistic/ts/space-before-function-paren': ['warn', { anonymous: 'always', named: 'never', asyncArrow: 'always' }], '@stylistic/js/space-infix-ops': 'off', '@stylistic/ts/space-infix-ops': ['warn', { int32Hint: false }], '@stylistic/ts/type-annotation-spacing': 'warn' } }; }