@rebeccastevens/eslint-config 3.2.5 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. package/dist/index.cjs +146 -71
  2. package/dist/index.d.cts +16718 -16629
  3. package/dist/index.d.mts +16718 -16629
  4. package/dist/index.mjs +133 -58
  5. package/package.json +53 -44
package/dist/index.cjs CHANGED
@@ -8,20 +8,20 @@ const fs = require('node:fs/promises');
8
8
  const globals = require('globals');
9
9
 
10
10
  function _interopNamespaceDefault(e) {
11
- const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
12
- if (e) {
13
- for (const k in e) {
14
- if (k !== 'default') {
15
- const d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: () => e[k]
19
- });
20
- }
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== 'default') {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
21
22
  }
22
- }
23
- n.default = e;
24
- return Object.freeze(n);
23
+ n.default = e;
24
+ return Object.freeze(n);
25
25
  }
26
26
 
27
27
  const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
@@ -60,28 +60,28 @@ async function loadPackages(packageIds) {
60
60
  return Promise.all(packageIds.map((id) => interopDefault(import(id))));
61
61
  }
62
62
  const installPackagesToLoad = new Set();
63
- let m_installPackagesAction = null;
64
- let m_installPackagesActionResolver = null;
65
- let m_installPackagesTimeout = null;
63
+ let mut_installPackagesAction = null;
64
+ let mut_installPackagesActionResolver = null;
65
+ let mut_installPackagesTimeout = null;
66
66
  /* eslint-disable functional/no-loop-statements */
67
67
  async function installPackages(packages) {
68
68
  for (const p of packages) {
69
69
  installPackagesToLoad.add(p);
70
70
  }
71
- if (m_installPackagesTimeout !== null) {
72
- clearTimeout(m_installPackagesTimeout);
71
+ if (mut_installPackagesTimeout !== null) {
72
+ clearTimeout(mut_installPackagesTimeout);
73
73
  }
74
- m_installPackagesTimeout = setTimeout(() => {
74
+ mut_installPackagesTimeout = setTimeout(() => {
75
75
  const allPackages = [...installPackagesToLoad.values()];
76
- m_installPackagesTimeout = null;
76
+ mut_installPackagesTimeout = null;
77
77
  installPackagesToLoad.clear();
78
- m_installPackagesAction = null;
79
- m_installPackagesActionResolver(allPackages);
80
- m_installPackagesActionResolver = null;
78
+ mut_installPackagesAction = null;
79
+ mut_installPackagesActionResolver(allPackages);
80
+ mut_installPackagesActionResolver = null;
81
81
  }, 100);
82
- if (m_installPackagesAction === null) {
83
- m_installPackagesAction = new Promise((resolve) => {
84
- m_installPackagesActionResolver = resolve;
82
+ if (mut_installPackagesAction === null) {
83
+ mut_installPackagesAction = new Promise((resolve) => {
84
+ mut_installPackagesActionResolver = resolve;
85
85
  }).then(async (allPackages) => {
86
86
  const allPackagesString = allPackages.join(", ");
87
87
  if (Boolean(process.env["CI"]) || !process.stdout.isTTY) {
@@ -98,7 +98,7 @@ async function installPackages(packages) {
98
98
  }
99
99
  });
100
100
  }
101
- return m_installPackagesAction;
101
+ return mut_installPackagesAction;
102
102
  }
103
103
  /* eslint-enable functional/no-loop-statements */
104
104
 
@@ -488,7 +488,7 @@ async function formatters(opts, stylistic) {
488
488
  "vue/template-curly-spacing": "off",
489
489
  "yaml/block-sequence-hyphen-indicator-newline": "off",
490
490
  };
491
- const m_configs = [
491
+ const mut_configs = [
492
492
  {
493
493
  name: "rs:formatters:setup",
494
494
  plugins: {
@@ -497,7 +497,7 @@ async function formatters(opts, stylistic) {
497
497
  },
498
498
  ];
499
499
  if (options.js !== undefined && options.js) {
500
- m_configs.push({
500
+ mut_configs.push({
501
501
  name: "rs:formatter:javascript",
502
502
  files: [GLOB_JS, GLOB_JSX],
503
503
  rules: {
@@ -513,7 +513,7 @@ async function formatters(opts, stylistic) {
513
513
  });
514
514
  }
515
515
  if (options.ts !== undefined && options.ts) {
516
- m_configs.push({
516
+ mut_configs.push({
517
517
  name: "rs:formatter:typescript",
518
518
  files: [GLOB_TS, GLOB_TSX],
519
519
  ignores: options.dts === true ? [] : [GLOB_DTS],
@@ -530,7 +530,7 @@ async function formatters(opts, stylistic) {
530
530
  });
531
531
  }
532
532
  if (options.yaml !== undefined && options.yaml) {
533
- m_configs.push({
533
+ mut_configs.push({
534
534
  name: "rs:formatter:yaml",
535
535
  files: [GLOB_YAML],
536
536
  languageOptions: {
@@ -549,7 +549,7 @@ async function formatters(opts, stylistic) {
549
549
  });
550
550
  }
551
551
  if (options.json !== undefined && options.json) {
552
- m_configs.push({
552
+ mut_configs.push({
553
553
  name: "rs:formatter:json",
554
554
  files: [GLOB_JSON],
555
555
  ignores: ["**/package.json"],
@@ -659,7 +659,7 @@ async function formatters(opts, stylistic) {
659
659
  });
660
660
  }
661
661
  if (options.css !== undefined && options.css) {
662
- m_configs.push({
662
+ mut_configs.push({
663
663
  name: "rs:formatter:css",
664
664
  files: [GLOB_CSS, GLOB_POSTCSS],
665
665
  languageOptions: {
@@ -710,7 +710,7 @@ async function formatters(opts, stylistic) {
710
710
  });
711
711
  }
712
712
  if (options.html !== undefined && options.html) {
713
- m_configs.push({
713
+ mut_configs.push({
714
714
  name: "rs:formatter:html",
715
715
  files: ["**/*.html"],
716
716
  languageOptions: {
@@ -734,7 +734,7 @@ async function formatters(opts, stylistic) {
734
734
  : options.slidev === true
735
735
  ? ["**/slides.md"]
736
736
  : (options.slidev.files ?? []);
737
- m_configs.push({
737
+ mut_configs.push({
738
738
  name: "rs:formatter:markdown",
739
739
  files: [GLOB_MARKDOWN],
740
740
  ignores: GLOB_SLIDEV,
@@ -754,7 +754,7 @@ async function formatters(opts, stylistic) {
754
754
  },
755
755
  });
756
756
  if (options.slidev !== undefined && options.slidev !== false) {
757
- m_configs.push({
757
+ mut_configs.push({
758
758
  name: "rs:formatter:slidev",
759
759
  files: GLOB_SLIDEV,
760
760
  languageOptions: {
@@ -776,7 +776,7 @@ async function formatters(opts, stylistic) {
776
776
  }
777
777
  }
778
778
  if (options.graphql !== undefined && options.graphql) {
779
- m_configs.push({
779
+ mut_configs.push({
780
780
  files: [GLOB_GRAPHQL],
781
781
  languageOptions: {
782
782
  parser: parserPlain,
@@ -794,7 +794,7 @@ async function formatters(opts, stylistic) {
794
794
  },
795
795
  });
796
796
  }
797
- return m_configs;
797
+ return mut_configs;
798
798
  }
799
799
 
800
800
  async function functional(options) {
@@ -846,7 +846,7 @@ async function functional(options) {
846
846
  "functional/immutable-data": [
847
847
  "error",
848
848
  {
849
- ignoreAccessorPattern: ["**.mutable*.**", "**.m_*.**"],
849
+ ignoreAccessorPattern: ["**.mut_*.**"],
850
850
  ignoreClasses: "fieldsOnly",
851
851
  ignoreImmediateMutation: true,
852
852
  ignoreNonConstDeclarations: true,
@@ -1226,7 +1226,7 @@ async function imports(options) {
1226
1226
  "import/no-dynamic-require": "error",
1227
1227
  },
1228
1228
  },
1229
- ...((typescript
1229
+ ...(typescript
1230
1230
  ? [
1231
1231
  {
1232
1232
  files: [GLOB_TS, GLOB_TSX, GLOB_DTS],
@@ -1247,7 +1247,7 @@ async function imports(options) {
1247
1247
  },
1248
1248
  },
1249
1249
  ]
1250
- : [])),
1250
+ : []),
1251
1251
  ];
1252
1252
  }
1253
1253
 
@@ -1618,7 +1618,7 @@ function javascript(options) {
1618
1618
  ? { props: false }
1619
1619
  : {
1620
1620
  props: true,
1621
- ignorePropertyModificationsForRegex: ["^[mM]_"],
1621
+ ignorePropertyModificationsForRegex: ["^[mM]ut_"],
1622
1622
  },
1623
1623
  ],
1624
1624
  }),
@@ -2078,10 +2078,11 @@ const RemixPackages = ["@remix-run/node", "@remix-run/react", "@remix-run/serve"
2078
2078
  const NextJsPackages = ["next"];
2079
2079
  async function react(options) {
2080
2080
  const { files, i18n, overrides, typescript, parserOptions } = options;
2081
- const [pluginReact, pluginReactHooks, pluginReactRefresh] = (await loadPackages([
2081
+ const [pluginReact, pluginReactHooks, pluginReactRefresh, pluginJsxA11y] = (await loadPackages([
2082
2082
  "@eslint-react/eslint-plugin",
2083
2083
  "eslint-plugin-react-hooks",
2084
2084
  "eslint-plugin-react-refresh",
2085
+ "eslint-plugin-jsx-a11y",
2085
2086
  ]));
2086
2087
  const parserTs = typescript ? await interopDefault(import('@typescript-eslint/parser')) : undefined;
2087
2088
  const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some((i) => localPkg.isPackageExists(i));
@@ -2098,6 +2099,7 @@ async function react(options) {
2098
2099
  "react-hooks-extra": plugins["@eslint-react/hooks-extra"],
2099
2100
  "react-naming-convention": plugins["@eslint-react/naming-convention"],
2100
2101
  "react-refresh": pluginReactRefresh,
2102
+ "jsx-a11y": pluginJsxA11y,
2101
2103
  },
2102
2104
  },
2103
2105
  {
@@ -2179,6 +2181,79 @@ async function react(options) {
2179
2181
  "react/prefer-destructuring-assignment": "error",
2180
2182
  "react/prefer-shorthand-boolean": "error",
2181
2183
  "react/prefer-shorthand-fragment": "error",
2184
+ "jsx-a11y/alt-text": "error",
2185
+ "jsx-a11y/anchor-has-content": "error",
2186
+ "jsx-a11y/anchor-is-valid": "error",
2187
+ "jsx-a11y/aria-activedescendant-has-tabindex": "error",
2188
+ "jsx-a11y/aria-props": "error",
2189
+ "jsx-a11y/aria-proptypes": "error",
2190
+ "jsx-a11y/aria-role": "error",
2191
+ "jsx-a11y/aria-unsupported-elements": "error",
2192
+ "jsx-a11y/autocomplete-valid": "error",
2193
+ "jsx-a11y/click-events-have-key-events": "error",
2194
+ "jsx-a11y/control-has-associated-label": [
2195
+ "off",
2196
+ {
2197
+ ignoreElements: ["audio", "canvas", "embed", "input", "textarea", "tr", "video"],
2198
+ ignoreRoles: [
2199
+ "grid",
2200
+ "listbox",
2201
+ "menu",
2202
+ "menubar",
2203
+ "radiogroup",
2204
+ "row",
2205
+ "tablist",
2206
+ "toolbar",
2207
+ "tree",
2208
+ "treegrid",
2209
+ ],
2210
+ includeRoles: ["alert", "dialog"],
2211
+ },
2212
+ ],
2213
+ "jsx-a11y/heading-has-content": "error",
2214
+ "jsx-a11y/html-has-lang": "error",
2215
+ "jsx-a11y/iframe-has-title": "error",
2216
+ "jsx-a11y/img-redundant-alt": "error",
2217
+ "jsx-a11y/interactive-supports-focus": [
2218
+ "error",
2219
+ {
2220
+ tabbable: [
2221
+ "button",
2222
+ "checkbox",
2223
+ "link",
2224
+ "progressbar",
2225
+ "searchbox",
2226
+ "slider",
2227
+ "spinbutton",
2228
+ "switch",
2229
+ "textbox",
2230
+ ],
2231
+ },
2232
+ ],
2233
+ "jsx-a11y/label-has-for": "off",
2234
+ "jsx-a11y/label-has-associated-control": "error",
2235
+ "jsx-a11y/media-has-caption": "error",
2236
+ "jsx-a11y/mouse-events-have-key-events": "error",
2237
+ "jsx-a11y/no-access-key": "error",
2238
+ "jsx-a11y/no-autofocus": "error",
2239
+ "jsx-a11y/no-distracting-elements": "error",
2240
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
2241
+ "jsx-a11y/no-noninteractive-element-interactions": [
2242
+ "error",
2243
+ {
2244
+ body: ["onError", "onLoad"],
2245
+ iframe: ["onError", "onLoad"],
2246
+ img: ["onError", "onLoad"],
2247
+ },
2248
+ ],
2249
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
2250
+ "jsx-a11y/no-noninteractive-tabindex": "error",
2251
+ "jsx-a11y/no-redundant-roles": "error",
2252
+ "jsx-a11y/no-static-element-interactions": "error",
2253
+ "jsx-a11y/role-has-required-aria-props": "error",
2254
+ "jsx-a11y/role-supports-aria-props": "error",
2255
+ "jsx-a11y/scope": "error",
2256
+ "jsx-a11y/tabindex-no-positive": "error",
2182
2257
  ...(typescript
2183
2258
  ? {
2184
2259
  "react/no-leaked-conditional-rendering": "error",
@@ -3109,7 +3184,7 @@ async function typescript(options) {
3109
3184
  selector: "variableLike",
3110
3185
  filter: { regex: "_[^_]+", match: true },
3111
3186
  format: ["camelCase", "PascalCase"],
3112
- prefix: ["m_", "M_"],
3187
+ prefix: ["mut_", "Mut_"],
3113
3188
  leadingUnderscore: "forbid",
3114
3189
  trailingUnderscore: "forbid",
3115
3190
  },
@@ -3122,7 +3197,7 @@ async function typescript(options) {
3122
3197
  {
3123
3198
  selector: "variable",
3124
3199
  format: ["camelCase", "PascalCase", "UPPER_CASE"],
3125
- prefix: ["m_", "M_"],
3200
+ prefix: ["mut_", "Mut_"],
3126
3201
  leadingUnderscore: "forbid",
3127
3202
  trailingUnderscore: "forbid",
3128
3203
  },
@@ -3139,7 +3214,7 @@ async function typescript(options) {
3139
3214
  filter: { regex: "_[^_]+", match: true },
3140
3215
  format: ["camelCase", "PascalCase"],
3141
3216
  modifiers: ["const"],
3142
- prefix: ["m_", "M_"],
3217
+ prefix: ["mut_", "Mut_"],
3143
3218
  leadingUnderscore: "forbid",
3144
3219
  trailingUnderscore: "forbid",
3145
3220
  },
@@ -3165,7 +3240,7 @@ async function typescript(options) {
3165
3240
  {
3166
3241
  selector: ["autoAccessor", "parameterProperty", "property"],
3167
3242
  format: ["camelCase", "PascalCase"],
3168
- prefix: ["m_", "M_"],
3243
+ prefix: ["mut_", "Mut_"],
3169
3244
  leadingUnderscore: "forbid",
3170
3245
  trailingUnderscore: "forbid",
3171
3246
  },
@@ -3174,7 +3249,7 @@ async function typescript(options) {
3174
3249
  filter: { regex: "_[^_]+", match: true },
3175
3250
  format: ["camelCase", "PascalCase"],
3176
3251
  modifiers: ["readonly"],
3177
- prefix: ["m_", "M_"],
3252
+ prefix: ["mut_", "Mut_"],
3178
3253
  leadingUnderscore: "forbid",
3179
3254
  trailingUnderscore: "forbid",
3180
3255
  },
@@ -3693,12 +3768,12 @@ async function rsEslint(options, ...userConfigs) {
3693
3768
  };
3694
3769
  const functionalConfigOptions = {
3695
3770
  functionalEnforcement,
3696
- ignoreNamePattern: ["^mutable", "^[mM]_"],
3771
+ ignoreNamePattern: ["^[mM]ut_"],
3697
3772
  ...resolveSubOptions(options, "functional"),
3698
3773
  };
3699
- const m_configs = [];
3774
+ const mut_configs = [];
3700
3775
  // Base configs
3701
- m_configs.push(ignores({
3776
+ mut_configs.push(ignores({
3702
3777
  projectRoot,
3703
3778
  ignores: ignoresOptions ?? [],
3704
3779
  ignoreFiles: ignoresFilesOptions,
@@ -3716,13 +3791,13 @@ async function rsEslint(options, ...userConfigs) {
3716
3791
  componentExts.push("vue");
3717
3792
  }
3718
3793
  if (sonarOptions) {
3719
- m_configs.push(sonar(functionalConfigOptions));
3794
+ mut_configs.push(sonar(functionalConfigOptions));
3720
3795
  }
3721
3796
  if (jsxOptions) {
3722
- m_configs.push(jsx());
3797
+ mut_configs.push(jsx());
3723
3798
  }
3724
3799
  if (typeScriptOptions !== false) {
3725
- m_configs.push(typescript({
3800
+ mut_configs.push(typescript({
3726
3801
  projectRoot,
3727
3802
  mode,
3728
3803
  files: [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)],
@@ -3734,14 +3809,14 @@ async function rsEslint(options, ...userConfigs) {
3734
3809
  }));
3735
3810
  }
3736
3811
  if (stylisticOptions !== false) {
3737
- m_configs.push(stylistic({
3812
+ mut_configs.push(stylistic({
3738
3813
  stylistic: stylisticOptions,
3739
3814
  typescript: hasTypeScript,
3740
3815
  overrides: getOverrides(options, "stylistic"),
3741
3816
  }));
3742
3817
  }
3743
3818
  if (functionalEnforcement !== "none" || mode === "library") {
3744
- m_configs.push(functional({
3819
+ mut_configs.push(functional({
3745
3820
  ...typescriptConfigOptions,
3746
3821
  ...functionalConfigOptions,
3747
3822
  overrides: getOverrides(options, "functional"),
@@ -3750,13 +3825,13 @@ async function rsEslint(options, ...userConfigs) {
3750
3825
  }));
3751
3826
  }
3752
3827
  if (testOptions !== false) {
3753
- m_configs.push(test({
3828
+ mut_configs.push(test({
3754
3829
  files: GLOB_TESTS,
3755
3830
  overrides: getOverrides(options, "test"),
3756
3831
  }));
3757
3832
  }
3758
3833
  if (vueOptions !== false) {
3759
- m_configs.push(vue({
3834
+ mut_configs.push(vue({
3760
3835
  ...typescriptConfigOptions,
3761
3836
  typescript: hasTypeScript,
3762
3837
  files: [GLOB_VUE],
@@ -3769,7 +3844,7 @@ async function rsEslint(options, ...userConfigs) {
3769
3844
  }));
3770
3845
  }
3771
3846
  if (reactOptions !== false) {
3772
- m_configs.push(react({
3847
+ mut_configs.push(react({
3773
3848
  ...typescriptConfigOptions,
3774
3849
  typescript: hasTypeScript,
3775
3850
  files: [GLOB_SRC],
@@ -3779,13 +3854,13 @@ async function rsEslint(options, ...userConfigs) {
3779
3854
  }));
3780
3855
  }
3781
3856
  if (tailwindOptions !== false) {
3782
- m_configs.push(tailwind({
3857
+ mut_configs.push(tailwind({
3783
3858
  stylistic: stylisticOptions,
3784
3859
  overrides: getOverrides(options, "tailwind"),
3785
3860
  }));
3786
3861
  }
3787
3862
  if (unoCSSOptions !== false) {
3788
- m_configs.push(unocss({
3863
+ mut_configs.push(unocss({
3789
3864
  attributify: true,
3790
3865
  strict: true,
3791
3866
  ...resolveSubOptions(options, "unocss"),
@@ -3793,28 +3868,28 @@ async function rsEslint(options, ...userConfigs) {
3793
3868
  }));
3794
3869
  }
3795
3870
  if (jsoncOptions !== false) {
3796
- m_configs.push(jsonc({
3871
+ mut_configs.push(jsonc({
3797
3872
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
3798
3873
  overrides: getOverrides(options, "jsonc"),
3799
3874
  stylistic: stylisticOptions,
3800
3875
  }), sortTsconfig());
3801
3876
  }
3802
3877
  if (yamlOptions !== false) {
3803
- m_configs.push(yaml({
3878
+ mut_configs.push(yaml({
3804
3879
  files: [GLOB_YAML],
3805
3880
  overrides: getOverrides(options, "yaml"),
3806
3881
  stylistic: stylisticOptions,
3807
3882
  }));
3808
3883
  }
3809
3884
  if (tomlOptions !== false) {
3810
- m_configs.push(toml({
3885
+ mut_configs.push(toml({
3811
3886
  files: [GLOB_TOML],
3812
3887
  overrides: getOverrides(options, "toml"),
3813
3888
  stylistic: stylisticOptions,
3814
3889
  }));
3815
3890
  }
3816
3891
  if (markdownOptions !== false) {
3817
- m_configs.push(markdown({
3892
+ mut_configs.push(markdown({
3818
3893
  enableTypeRequiredRules: !(markdownOptions === true || markdownOptions.enableTypeRequiredRules === false),
3819
3894
  files: [GLOB_MARKDOWN],
3820
3895
  componentExts,
@@ -3822,17 +3897,17 @@ async function rsEslint(options, ...userConfigs) {
3822
3897
  }));
3823
3898
  }
3824
3899
  if (formattersOptions !== false) {
3825
- m_configs.push(formatters(formattersOptions, stylisticOptions === false ? {} : stylisticOptions));
3900
+ mut_configs.push(formatters(formattersOptions, stylisticOptions === false ? {} : stylisticOptions));
3826
3901
  }
3827
3902
  if (isInEditor) {
3828
- m_configs.push(inEditor());
3903
+ mut_configs.push(inEditor());
3829
3904
  }
3830
- m_configs.push(overrides());
3831
- let m_composer = new FlatConfigComposer().append(...m_configs, ...userConfigs);
3905
+ mut_configs.push(overrides());
3906
+ let mut_composer = new FlatConfigComposer().append(...mut_configs, ...userConfigs);
3832
3907
  if (autoRenamePlugins) {
3833
- m_composer = m_composer.renamePlugins(defaultPluginRenaming);
3908
+ mut_composer = mut_composer.renamePlugins(defaultPluginRenaming);
3834
3909
  }
3835
- return m_composer.toConfigs();
3910
+ return mut_composer.toConfigs();
3836
3911
  }
3837
3912
  function resolveSubOptions(options, key) {
3838
3913
  return (typeof options[key] === "boolean" || typeof options[key] === "string" ? {} : (options[key] ?? {}));