Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/eslint-plugin-react/index.js
rd565449 r0c6b92a 12 12 /** 13 13 * @param {object} rules - rules object mapping rule name to rule module 14 * @returns {Record<string, 2 >}14 * @returns {Record<string, 2 | 'error'>} 15 15 */ 16 16 function configureAsError(rules) { … … 18 18 } 19 19 20 /** @type {Partial<typeof allRules>} */ 20 21 const activeRules = filterRules(allRules, (rule) => !rule.meta.deprecated); 22 /** @type {Record<keyof typeof activeRules, 2 | 'error'>} */ 21 23 const activeRulesConfig = configureAsError(activeRules); 22 24 25 /** @type {Partial<typeof allRules>} */ 23 26 const deprecatedRules = filterRules(allRules, (rule) => rule.meta.deprecated); 24 27 28 /** @type {['react']} */ 25 29 // for legacy config system 26 30 const plugins = [ … … 28 32 ]; 29 33 30 const plugin = { 31 deprecatedRules, 32 rules: allRules, 33 configs: { 34 recommended: { 35 plugins, 36 parserOptions: { 37 ecmaFeatures: { 38 jsx: true, 39 }, 40 }, 41 rules: { 42 'react/display-name': 2, 43 'react/jsx-key': 2, 44 'react/jsx-no-comment-textnodes': 2, 45 'react/jsx-no-duplicate-props': 2, 46 'react/jsx-no-target-blank': 2, 47 'react/jsx-no-undef': 2, 48 'react/jsx-uses-react': 2, 49 'react/jsx-uses-vars': 2, 50 'react/no-children-prop': 2, 51 'react/no-danger-with-children': 2, 52 'react/no-deprecated': 2, 53 'react/no-direct-mutation-state': 2, 54 'react/no-find-dom-node': 2, 55 'react/no-is-mounted': 2, 56 'react/no-render-return-value': 2, 57 'react/no-string-refs': 2, 58 'react/no-unescaped-entities': 2, 59 'react/no-unknown-property': 2, 60 'react/no-unsafe': 0, 61 'react/prop-types': 2, 62 'react/react-in-jsx-scope': 2, 63 'react/require-render-return': 2, 34 const configs = { 35 recommended: { 36 plugins, 37 parserOptions: { 38 ecmaFeatures: { 39 jsx: true, 64 40 }, 65 41 }, 66 all: { 67 plugins, 68 parserOptions: { 69 ecmaFeatures: { 70 jsx: true, 71 }, 42 rules: { 43 'react/display-name': 2, 44 'react/jsx-key': 2, 45 'react/jsx-no-comment-textnodes': 2, 46 'react/jsx-no-duplicate-props': 2, 47 'react/jsx-no-target-blank': 2, 48 'react/jsx-no-undef': 2, 49 'react/jsx-uses-react': 2, 50 'react/jsx-uses-vars': 2, 51 'react/no-children-prop': 2, 52 'react/no-danger-with-children': 2, 53 'react/no-deprecated': 2, 54 'react/no-direct-mutation-state': 2, 55 'react/no-find-dom-node': 2, 56 'react/no-is-mounted': 2, 57 'react/no-render-return-value': 2, 58 'react/no-string-refs': 2, 59 'react/no-unescaped-entities': 2, 60 'react/no-unknown-property': 2, 61 'react/no-unsafe': 0, 62 'react/prop-types': 2, 63 'react/react-in-jsx-scope': 2, 64 'react/require-render-return': 2, 65 }, 66 }, 67 all: { 68 plugins, 69 parserOptions: { 70 ecmaFeatures: { 71 jsx: true, 72 72 }, 73 rules: activeRulesConfig,74 73 }, 75 'jsx-runtime': {76 plugins,77 parserOptions: {78 ecmaFeatures: {79 jsx: true,80 },81 jsx Pragma: null, // for @typescript/eslint-parser74 rules: activeRulesConfig, 75 }, 76 'jsx-runtime': { 77 plugins, 78 parserOptions: { 79 ecmaFeatures: { 80 jsx: true, 82 81 }, 83 rules: { 84 'react/react-in-jsx-scope': 0, 85 'react/jsx-uses-react': 0, 86 }, 82 jsxPragma: null, // for @typescript/eslint-parser 83 }, 84 rules: { 85 'react/react-in-jsx-scope': 0, 86 'react/jsx-uses-react': 0, 87 87 }, 88 88 }, 89 89 }; 90 90 91 plugin.configs.flat = { 91 /** @typedef {{ plugins: { react: typeof plugin }, rules: import('eslint').Linter.RulesRecord, languageOptions: { parserOptions: import('eslint').Linter.ParserOptions } }} ReactFlatConfig */ 92 93 /** @type {{ deprecatedRules: typeof deprecatedRules, rules: typeof allRules, configs: typeof configs & { flat?: Record<string, ReactFlatConfig> }}} */ 94 const plugin = { 95 deprecatedRules, 96 rules: allRules, 97 configs, 98 }; 99 100 /** @type {Record<string, ReactFlatConfig>} */ 101 configs.flat = { 92 102 recommended: { 93 103 plugins: { react: plugin }, 94 rules: plugin.configs.recommended.rules,95 languageOptions: { parserOptions: plugin.configs.recommended.parserOptions },104 rules: configs.recommended.rules, 105 languageOptions: { parserOptions: configs.recommended.parserOptions }, 96 106 }, 97 107 all: { 98 108 plugins: { react: plugin }, 99 rules: plugin.configs.all.rules,100 languageOptions: { parserOptions: plugin.configs.all.parserOptions },109 rules: configs.all.rules, 110 languageOptions: { parserOptions: configs.all.parserOptions }, 101 111 }, 102 112 'jsx-runtime': { 103 113 plugins: { react: plugin }, 104 rules: plugin.configs['jsx-runtime'].rules,105 languageOptions: { parserOptions: plugin.configs['jsx-runtime'].parserOptions },114 rules: configs['jsx-runtime'].rules, 115 languageOptions: { parserOptions: configs['jsx-runtime'].parserOptions }, 106 116 }, 107 117 };
Note:
See TracChangeset
for help on using the changeset viewer.