Skip to content

Instantly share code, notes, and snippets.

@azu

azu/.eslintrc.js Secret

Created Nov 4, 2020
Embed
What would you like to do?
When use @typescript-eslint/eslint-recommended, can not set `prefer-const: warn`.
module.exports = {
root: true,
extends: ['eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {
// .tsに対してはなぜか効いてない
'prefer-const': 'warn',
},
overrides: [
{
files: ['**/*.ts'],
rules: {
// FIXME: .tsの場合に、rulesの設定がなぜかextendsしているplugin:@typescript-eslint/eslint-recommendedで上書きされてしまう
// https://github.com/typescript-eslint/typescript-eslint/blob/1765a178e456b152bd48192eb5db7e8541e2adf2/packages/eslint-plugin/src/configs/eslint-recommended.ts#L27-L28
'prefer-const': 'warn',
'no-var': 'warn',
},
},
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment