Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[@typescript-eslint/no-unused-vars] Use config of ESLint built-in "no-unused-vars" rule when no config exists for typescript counterpart #268

Closed
Labels
duplicateThis issue or pull request already existspackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@evangalen

Description

@evangalen

In our.eslintrc.js we use the configuration of'airbnb-base' that enables and configures the ESLint built-in rules of "camelcase", "indent", "no-array-constructor" and "no-unused-vars".

To ensure that we don't get double rule violations (on for the ESLint build-in and the TypeScript counterpart),
we deliberately place'plugin:@typescript-eslint/recommended' after'airbnb-base':

module.exports = {  extends: [    'eslint:recommended',    'airbnb-base',    // placed after 'airbnb-base' so that enabled rules are replaced with TypeScript specific ones    'plugin:@typescript-eslint/recommended',  ],  // ...};

Problem with this approach is that@typescript-eslint/eslint-plugin will use a different configuration as the for the ESLint built-in rules of "camelcase", "indent", "no-array-constructor" and "no-unused-vars".

So I was wondering if it wouldn't be possible that@typescript-eslint/eslint-plugin uses the configuration of ESLint built-in rules in case no explicit configuration exists for the TypeScript counterparts.

Right now, we had to work around the problem by explicitltyrequire-ing the rules of the "eslint-config-airbnb-base" module and then re-configure them using the imported rule config:

const airbnbImportsRules = require('eslint-config-airbnb-base/rules/imports').rules;const airbnbStyleRules = require('eslint-config-airbnb-base/rules/style').rules;const airbnbVariablesRules = require('eslint-config-airbnb-base/rules/variables').rules;module.exports = {  extends: [    'eslint:recommended',    'airbnb-base',    // placed after 'airbnb-base' so that enabled rules are replaced with TypeScript specific ones    'plugin:@typescript-eslint/recommended',  ],  plugins: ['@typescript-eslint'],  settings: {    'import/resolver': {      'webpack': {        config: path.join(__dirname, 'webpack.config.prod.js'),      }    },  },  env: {    browser: true,    es6: true,  },  parser: '@typescript-eslint/parser',  parserOptions: {    'project': './tsconfig.json'  },  rules: {    // ...    // configure TypeScript counterpart rules with the original airbnb rule configuration    '@typescript-eslint/camelcase': airbnbStyleRules.camelcase,    '@typescript-eslint/indent': airbnbStyleRules.indent,    '@typescript-eslint/no-array-constructor': airbnbStyleRules['no-array-constructor'],    '@typescript-eslint/no-unused-vars': airbnbVariablesRules['no-unused-vars'],    // ...  },};

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existspackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp