ipynb2html/.eslintrc.js
Jakub Jirutka 9cabcadd4c Fix wrong named imports and disable corresponding ESLint rule
It doesn't work when the code is bundled using Rollup.js. This problem
was introduced in 0394738a35. KaTeX and
Marked have it wrong in type declarations, so ESLint rule
import/no-named-as-default-member is not very helpful here...
2019-10-14 01:04:55 +02:00

142 lines
4.4 KiB
JavaScript

const tsconfigs = [
'tsconfig.json',
'test/tsconfig.json',
]
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: tsconfigs,
},
env: {
es6: true,
node: true,
},
settings: {
'import/resolver': {
// Use eslint-import-resolver-ts to obey "paths" in tsconfig.json.
ts: {
directory: tsconfigs,
},
},
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'standard-with-typescript',
'plugin:import/recommended',
'plugin:import/typescript',
],
rules: {
'comma-dangle': ['error', 'always-multiline'],
// Disable in favour of TypeScript rule.
'func-call-spacing': 'off',
'linebreak-style': ['error', 'unix'],
'lines-between-class-members': 'off',
// Disable in favour of TypeScript rule.
'no-extra-semi': 'off',
'no-multi-spaces': ['warn', {
ignoreEOLComments: true,
}],
'no-multiple-empty-lines': ['warn', {
max: 2,
maxEOF: 1,
maxBOF: 1,
}],
'no-template-curly-in-string': 'off',
'operator-linebreak': ['error', 'before'],
'padded-blocks': ['warn', {
switches: 'never',
}],
'quote-props': ['error', 'consistent-as-needed'],
// Disable in favour of TypeScript rule.
'semi': 'off',
// Import
'import/default': 'off',
'import/newline-after-import': 'warn',
'import/no-absolute-path': 'error',
// This rule disallows using both wildcard and selective imports from the same module.
'import/no-duplicates': 'off',
// Some packages has it wrong in type declarations (e.g. katex, marked).
'import/no-named-as-default-member': 'off',
// TypeScript
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': ['warn', {
accessibility: 'no-public',
overrides: {
parameterProperties: 'off',
},
}],
'@typescript-eslint/func-call-spacing': ['error', 'never'],
'@typescript-eslint/indent': ['error', 2, {
SwitchCase: 1,
VariableDeclarator: 1,
outerIIFEBody: 1,
MemberExpression: 1,
// Changed parameters from 1 to off.
FunctionDeclaration: { parameters: 'off', body: 1 },
// Changed parameters from 1 to off.
FunctionExpression: { parameters: 'off', body: 1 },
// Changed arguments from 1 to off.
CallExpression: { arguments: 'off' },
ArrayExpression: 1,
ObjectExpression: 1,
ImportDeclaration: 1,
// Changed from false to true.
flatTernaryExpressions: true,
ignoreComments: false,
}],
'@typescript-eslint/member-delimiter-style': ['error', {
multiline: { delimiter: 'comma', requireLast: true },
singleline: { delimiter: 'comma', requireLast: false },
}],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-namespace': 'warn',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-unused-vars': ['error', {
argsIgnorePattern: '^_',
}],
'@typescript-eslint/no-use-before-define': ['error', {
classes: true,
functions: false,
typedefs: false,
variables: true,
}],
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-includes': 'warn',
'@typescript-eslint/prefer-regexp-exec': 'warn',
'@typescript-eslint/prefer-string-starts-ends-with': 'warn',
'@typescript-eslint/promise-function-async': ['error', {
allowAny: true,
}],
'@typescript-eslint/semi': ['error', 'never'],
'@typescript-eslint/strict-boolean-expressions': 'off',
},
overrides: [
{
files: ['*.test.ts?(x)'],
rules: {
// Allow to format arrays for parametrized tests as tables.
'array-bracket-spacing': 'off',
'comma-spacing': 'off',
'object-curly-spacing': 'off',
'no-multi-spaces': 'off',
'standard/array-bracket-even-spacing': 'off',
// Allow spaces inside expect( foo ).
'space-in-parens': 'off',
// jest.mock() must be above imports.
'import/first': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
],
}