|
| 1 | +const { FlatCompat } = require('@eslint/eslintrc'); |
| 2 | +const tsParser = require('@typescript-eslint/parser'); |
| 3 | +const tsPlugin = require('@typescript-eslint/eslint-plugin'); |
| 4 | +const reactPlugin = require('eslint-plugin-react'); |
| 5 | +const headersPlugin = require('eslint-plugin-headers'); |
| 6 | + |
| 7 | +const compat = new FlatCompat({ |
| 8 | + baseDirectory: __dirname, |
| 9 | +}); |
| 10 | + |
| 11 | +module.exports = [ |
| 12 | + { |
| 13 | + ignores: ['**/*.d.ts', 'src/test/**/*.ts', 'demos/**/*', '**/*.js', 'testWorkspace/**'], |
| 14 | + }, |
| 15 | + { |
| 16 | + linterOptions: { |
| 17 | + reportUnusedDisableDirectives: 'off', |
| 18 | + }, |
| 19 | + }, |
| 20 | + ...compat.extends('plugin:react/recommended', 'plugin:@typescript-eslint/recommended'), |
| 21 | + { |
| 22 | + files: ['src/**/*.ts'], |
| 23 | + languageOptions: { |
| 24 | + parser: tsParser, |
| 25 | + ecmaVersion: 2018, |
| 26 | + sourceType: 'module', |
| 27 | + }, |
| 28 | + plugins: { |
| 29 | + '@typescript-eslint': tsPlugin, |
| 30 | + react: reactPlugin, |
| 31 | + headers: headersPlugin, |
| 32 | + }, |
| 33 | + settings: { |
| 34 | + react: { |
| 35 | + pragma: 'h', |
| 36 | + version: '16.3', |
| 37 | + }, |
| 38 | + }, |
| 39 | + rules: { |
| 40 | + // Temporary until CDP is moved out, which is where most violations are: |
| 41 | + '@typescript-eslint/ban-types': 'off', |
| 42 | + |
| 43 | + '@typescript-eslint/no-var-requires': 'off', |
| 44 | + '@typescript-eslint/no-require-imports': 'off', |
| 45 | + '@typescript-eslint/no-use-before-define': 'off', |
| 46 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 47 | + '@typescript-eslint/no-namespace': 'off', |
| 48 | + '@typescript-eslint/no-empty-object-type': 'off', |
| 49 | + '@typescript-eslint/no-explicit-any': 'off', |
| 50 | + '@typescript-eslint/no-non-null-asserted-optional-chain': 'off', |
| 51 | + '@typescript-eslint/no-unsafe-function-type': 'off', |
| 52 | + '@typescript-eslint/no-unused-expressions': 'off', |
| 53 | + '@typescript-eslint/ban-ts-comment': 'off', |
| 54 | + 'prefer-const': ['error', { destructuring: 'all' }], |
| 55 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 56 | + // Current repository headers use a legacy style that would require mass edits to older files. |
| 57 | + 'headers/header-format': 'off', |
| 58 | + 'react/no-unescaped-entities': 'off', |
| 59 | + 'react/prop-types': 'off', |
| 60 | + '@typescript-eslint/no-unused-vars': 'off', |
| 61 | + }, |
| 62 | + }, |
| 63 | +]; |
0 commit comments