Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/eslint-plugin-react/index.js

    rd565449 r0c6b92a  
    1212/**
    1313 * @param {object} rules - rules object mapping rule name to rule module
    14  * @returns {Record<string, 2>}
     14 * @returns {Record<string, 2 | 'error'>}
    1515 */
    1616function configureAsError(rules) {
     
    1818}
    1919
     20/** @type {Partial<typeof allRules>} */
    2021const activeRules = filterRules(allRules, (rule) => !rule.meta.deprecated);
     22/** @type {Record<keyof typeof activeRules, 2 | 'error'>} */
    2123const activeRulesConfig = configureAsError(activeRules);
    2224
     25/** @type {Partial<typeof allRules>} */
    2326const deprecatedRules = filterRules(allRules, (rule) => rule.meta.deprecated);
    2427
     28/** @type {['react']} */
    2529// for legacy config system
    2630const plugins = [
     
    2832];
    2933
    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,
     34const configs = {
     35  recommended: {
     36    plugins,
     37    parserOptions: {
     38      ecmaFeatures: {
     39        jsx: true,
    6440      },
    6541    },
    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,
    7272      },
    73       rules: activeRulesConfig,
    7473    },
    75     'jsx-runtime': {
    76       plugins,
    77       parserOptions: {
    78         ecmaFeatures: {
    79           jsx: true,
    80         },
    81         jsxPragma: null, // for @typescript/eslint-parser
     74    rules: activeRulesConfig,
     75  },
     76  'jsx-runtime': {
     77    plugins,
     78    parserOptions: {
     79      ecmaFeatures: {
     80        jsx: true,
    8281      },
    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,
    8787    },
    8888  },
    8989};
    9090
    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> }}} */
     94const plugin = {
     95  deprecatedRules,
     96  rules: allRules,
     97  configs,
     98};
     99
     100/** @type {Record<string, ReactFlatConfig>} */
     101configs.flat = {
    92102  recommended: {
    93103    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 },
    96106  },
    97107  all: {
    98108    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 },
    101111  },
    102112  'jsx-runtime': {
    103113    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 },
    106116  },
    107117};
Note: See TracChangeset for help on using the changeset viewer.