Skip to content

Commit

Permalink
chore: import values for equivalent rules from Standard
Browse files Browse the repository at this point in the history
Fixes #160.
  • Loading branch information
mightyiam committed Nov 15, 2019
1 parent 15b66ba commit b106034
Showing 1 changed file with 24 additions and 31 deletions.
55 changes: 24 additions & 31 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
import { rules as standardRules } from 'eslint-config-standard/eslintrc.json'

const equivalents = [
'brace-style',
'camelcase',
'indent',
'no-array-constructor',
'no-unused-vars',
'no-useless-constructor',
'quotes'
] as const

export = {
extends: 'eslint-config-standard',
plugins: ['@typescript-eslint'],
Expand All @@ -10,42 +22,21 @@ export = {
'no-undef': 'off',

// Rules replaced by @typescript-eslint versions:
'brace-style': 'off',
camelcase: 'off',
indent: 'off',
'no-array-constructor': 'off',
'no-unused-vars': 'off',
...Object.fromEntries(equivalents.map((name) => [name, 'off'])),
'no-use-before-define': 'off',
'no-useless-constructor': 'off',
quotes: 'off',

// @typescript-eslint versions of Standard.js rules:
'@typescript-eslint/brace-style': ['error', '1tbs', { allowSingleLine: true }],
'@typescript-eslint/camelcase': ['error', { properties: 'never' }],
'@typescript-eslint/indent': ['error', 2, {
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
MemberExpression: 1,
FunctionDeclaration: { parameters: 1, body: 1 },
FunctionExpression: { parameters: 1, body: 1 },
CallExpression: { arguments: 1 },
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
flatTernaryExpressions: false,
ignoreComments: false,
ignoredNodes: ['TemplateLiteral *']
...Object.fromEntries(
equivalents.map((name) => [`@typescript-eslint/${name}`, standardRules[name]])
),
'@typescript-eslint/no-use-before-define': ['error', {
functions: false,
classes: false,
variables: false,
typedefs: false // Only the TypeScript rule has this option.
}],
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-unused-vars': ['error', { vars: 'all', args: 'none', ignoreRestSiblings: true }],
'@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false, variables: false, typedefs: false }],
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
'@typescript-eslint/require-await': 'error',

// New Typescript-only rules:
// Rules exclusive to Standard TypeScript:
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/consistent-type-assertions': [
Expand All @@ -69,6 +60,7 @@ export = {
singleline: { delimiter: 'comma', requireLast: false }
}
],
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-floating-promises': 'error',
Expand All @@ -84,6 +76,7 @@ export = {
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
'@typescript-eslint/strict-boolean-expressions': 'error',
'@typescript-eslint/triple-slash-reference': ['error', { lib: 'never', path: 'never', types: 'never' }],
Expand Down

0 comments on commit b106034

Please sign in to comment.