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 12, 2019
1 parent 71cf7ff commit 3b78ee9
Showing 1 changed file with 26 additions and 29 deletions.
55 changes: 26 additions & 29 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
import { rules as standardRules } from 'eslint-config-standard/eslintrc.json'

const equivalents = [
'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,40 +21,24 @@ export = {
'no-undef': 'off',

// Rules replaced by @typescript-eslint versions:
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/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 @@ -67,6 +62,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 @@ -82,6 +78,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 3b78ee9

Please sign in to comment.