Skip to content

Instantly share code, notes, and snippets.

@azu

azu/.eslintrc.js Secret

Created November 4, 2020 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azu/aeefe6042ebb605400d10b2dbce50385 to your computer and use it in GitHub Desktop.
Save azu/aeefe6042ebb605400d10b2dbce50385 to your computer and use it in GitHub Desktop.
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