go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/frontend/ui/.eslintrc.cjs (about)

     1  // Copyright 2022 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // eslint-disable-next-line no-undef
    16  module.exports = {
    17    'env': {
    18      'browser': true,
    19      'es2021': true,
    20    },
    21    'extends': [
    22      'eslint:recommended',
    23      'plugin:react/recommended',
    24      'plugin:react-hooks/recommended',
    25      'prettier',
    26      'google',
    27      'plugin:@typescript-eslint/recommended',
    28      'plugin:import/recommended',
    29      'plugin:import/typescript',
    30      'plugin:jsx-a11y/recommended',
    31    ],
    32    'settings': {
    33      'react': {
    34        'version': 'detect',
    35      },
    36      'import/parsers': {
    37        '@typescript-eslint/parser': ['.ts', '.tsx'],
    38      },
    39      'import/resolver': {
    40        'typescript': {},
    41      },
    42    },
    43    'overrides': [
    44      {
    45        'files': ['src/**/*.test.tsx'],
    46        'plugins': ['jest'],
    47        'extends': ['plugin:jest/recommended'],
    48      },
    49      {
    50        'files': ['cypress/**'],
    51        'plugins': ['cypress'],
    52        'extends': ['plugin:cypress/recommended'],
    53      },
    54    ],
    55    'parser': '@typescript-eslint/parser',
    56    'parserOptions': {
    57      'ecmaFeatures': {
    58        'jsx': true,
    59      },
    60      'ecmaVersion': 'latest',
    61      'sourceType': 'module',
    62    },
    63    'plugins': [
    64      'react',
    65      '@typescript-eslint',
    66      'prettier',
    67      'jsx-a11y',
    68      'import',
    69    ],
    70    'rules': {
    71      // Code generated from protobuf may contain '_' in the identifier name,
    72      // (e.g. `BuilderMask_BuilderMaskType`) and therefore triggering the error.
    73      // `"ignoreImports": true` doesn't fix the issue because checks are still
    74      // applied where the imported symbol is used.
    75      //
    76      // Since this rule doesn't add a lot of value (it only checks whether there
    77      // are '_' in non-leading/trailing positions), disable it to reduce noise.
    78      //
    79      // Note that we should still generally use camelcase.
    80      'camelcase': 0,
    81      'quotes': ['error', 'single'],
    82      'semi': ['error', 'always'],
    83      'object-curly-spacing': ['error', 'always', { 'objectsInObjects': true }],
    84      'require-jsdoc': 0,
    85      'import/order': ['error', {
    86        'pathGroups': [
    87          {
    88            'pattern': '@/**',
    89            'group': 'external',
    90            'position': 'after',
    91          },
    92        ],
    93      }],
    94      'import/no-unresolved': 'error',
    95      'no-trailing-spaces': 'error',
    96      'no-console': ['error', { allow: ['error'] }],
    97      'eol-last': ['error', 'always'],
    98      'react/jsx-uses-react': 'off',
    99      'react/react-in-jsx-scope': 'off',
   100      'max-len': 'off',
   101    },
   102  };