Skip to content

Web: 2 Eslint configs and Eslint is linting build folder for web #25

@artandrey

Description

@artandrey

Remove .eslintrc.json file and leave only .eslintrc.cjs with following content:

module.exports = {
  root: true,
  env: { browser: true, es2020: true },
  parserOptions: {
    ecmaVersion: 12,
    sourceType: 'module',
  },
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:react-hooks/recommended',
    'plugin:react/recommended',
    '@feature-sliced',
    '@feature-sliced/eslint-config/rules/import-order',
  ],
  ignorePatterns: ['build', '.eslintrc.cjs', 'tailwind.config.js', 'postcss.config.js'],
  parser: '@typescript-eslint/parser',
  plugins: ['react-refresh', '@typescript-eslint', 'react-hooks', 'import'],
  rules: {
    // react-refresh rules (all as warnings)
    'react-refresh/only-export-components': 'warn',

    // typescript rules
    'no-unused-vars': 'off',
    '@typescript-eslint/no-unused-vars': 'warn', // changed to warn
    '@typescript-eslint/consistent-type-imports': [
      'warn',
      { fixStyle: 'inline-type-imports' },
    ], // changed to warn
    '@typescript-eslint/no-explicit-any': 'off',
    '@typescript-eslint/no-var-requires': 'off',
    '@typescript-eslint/no-non-null-assertion': 'off',

    // react rules
    'react-hooks/rules-of-hooks': 'warn', // changed to warn
    'react-hooks/exhaustive-deps': 'off',
    'react/no-unknown-property': ['warn', { ignore: ['css'] }], // changed to warn
    'react/prop-types': 'off',
    'react/display-name': 'off',
    'react/no-unescaped-entities': 'off',
    'react/react-in-jsx-scope': 'off',

    // other rules
    'dot-notation': 'warn',
    'valid-typeof': 'warn',
    'import/no-internal-modules': ['warn', { forbid: ['shared/styles/*'] }],

    // feature-sliced rules
    'boundaries/element-types': 'warn', // changed to warn
  },
  settings: {
    react: {
      pragma: 'React',
      version: 'detect',
    },
    'import/resolver': {
      typescript: {
        alwaysTryTypes: true,
      },
    },
  },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions