@storm-software/eslint 0.126.0 → 0.126.2

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.
package/dist/preset.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Linter } from 'eslint';
2
2
  import { FlatConfigComposer } from 'eslint-flat-config-utils';
3
- import { O as OptionsConfig, R as RuleOptions, T as TypedFlatConfigItem, A as Awaitable, C as ConfigNames } from './types-oCxTBmlp.js';
3
+ import { O as OptionsConfig, R as RuleOptions, T as TypedFlatConfigItem, A as Awaitable, C as ConfigNames } from './types-CnDDaY3J.js';
4
4
  import '@nx/eslint-plugin/src/utils/runtime-lint-utils';
5
5
  import '@stylistic/eslint-plugin';
6
6
  import '@typescript-eslint/parser';
package/dist/preset.js CHANGED
@@ -202,15 +202,41 @@ async function stylistic(options = {}) {
202
202
  "error",
203
203
  lineEndings
204
204
  ],
205
- // "style/padding-line-between-statements": [
206
- // "error",
207
- // { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
208
- // {
209
- // blankLine: "any",
210
- // prev: ["const", "let", "var"],
211
- // next: ["const", "let", "var"]
212
- // }
213
- // ],
205
+ "style/comma-dangle": [
206
+ "error",
207
+ "never"
208
+ ],
209
+ "style/comma-style": [
210
+ "error",
211
+ "last"
212
+ ],
213
+ "style/quotes": [
214
+ "error",
215
+ quotes
216
+ ],
217
+ "style/semi": [
218
+ "error",
219
+ semi ? "always" : "never"
220
+ ],
221
+ "style/indent": [
222
+ "error",
223
+ indent,
224
+ {
225
+ SwitchCase: 1
226
+ }
227
+ ],
228
+ "style/operator-linebreak": [
229
+ "error",
230
+ "after"
231
+ ],
232
+ "style/jsx-indent": [
233
+ "error",
234
+ indent
235
+ ],
236
+ "style/jsx-quotes": [
237
+ "error",
238
+ quotes === "single" ? "prefer-single" : "prefer-double"
239
+ ],
214
240
  ...overrides
215
241
  }
216
242
  }
@@ -743,9 +769,10 @@ import { default as default2 } from "@cspell/eslint-plugin";
743
769
  import { default as default3 } from "@nx/eslint-plugin/nx.js";
744
770
  import * as pluginImport from "eslint-plugin-import-x";
745
771
  import { default as default4 } from "eslint-plugin-n";
746
- import { default as default5 } from "eslint-plugin-perfectionist";
747
- import { default as default6 } from "eslint-plugin-unicorn";
748
- import { default as default7 } from "eslint-plugin-unused-imports";
772
+ import { default as default5 } from "eslint-plugin-no-secrets";
773
+ import { default as default6 } from "eslint-plugin-perfectionist";
774
+ import { default as default7 } from "eslint-plugin-unicorn";
775
+ import { default as default8 } from "eslint-plugin-unused-imports";
749
776
 
750
777
  // src/configs/imports.ts
751
778
  async function imports(options = {}) {
@@ -834,7 +861,7 @@ async function javascript(options = {}) {
834
861
  {
835
862
  name: "storm/javascript/rules",
836
863
  plugins: {
837
- "unused-imports": default7
864
+ "unused-imports": default8
838
865
  },
839
866
  rules: {
840
867
  // disallow use of console
@@ -1909,7 +1936,7 @@ async function javascript(options = {}) {
1909
1936
  }
1910
1937
  ],
1911
1938
  "prefer-const": [
1912
- isInEditor ? "warn" : "error",
1939
+ "error",
1913
1940
  {
1914
1941
  destructuring: "all",
1915
1942
  ignoreReadBeforeAssign: true
@@ -1926,7 +1953,7 @@ async function javascript(options = {}) {
1926
1953
  "prefer-spread": "error",
1927
1954
  "prefer-template": "error",
1928
1955
  "symbol-description": "error",
1929
- "unused-imports/no-unused-imports": isInEditor ? "warn" : "error",
1956
+ "unused-imports/no-unused-imports": "error",
1930
1957
  "unused-imports/no-unused-vars": [
1931
1958
  "error",
1932
1959
  {
@@ -2532,7 +2559,7 @@ async function nx(options = {}) {
2532
2559
  "@nx/enforce-module-boundaries": [
2533
2560
  "error",
2534
2561
  moduleBoundaries ?? {
2535
- enforceBuildableLibDependency: true,
2562
+ enforceBuildableLibDependency: false,
2536
2563
  checkDynamicDependenciesExceptions: [
2537
2564
  ".*"
2538
2565
  ],
@@ -2557,9 +2584,9 @@ __name(nx, "nx");
2557
2584
  async function perfectionist() {
2558
2585
  return [
2559
2586
  {
2560
- name: "storm/perfectionist/setup",
2587
+ name: "storm/perfectionist/rules",
2561
2588
  plugins: {
2562
- perfectionist: default5
2589
+ perfectionist: default6
2563
2590
  },
2564
2591
  rules: {
2565
2592
  "perfectionist/sort-exports": [
@@ -2817,6 +2844,13 @@ async function regexp(options = {}) {
2817
2844
  name: "storm/regexp/rules",
2818
2845
  rules: {
2819
2846
  ...rules,
2847
+ "regexp/no-unused-capturing-group": [
2848
+ "error",
2849
+ {
2850
+ fixable: true,
2851
+ allowNamed: false
2852
+ }
2853
+ ],
2820
2854
  ...options.overrides
2821
2855
  }
2822
2856
  }
@@ -3291,7 +3325,9 @@ async function typescript(options = {}) {
3291
3325
  "error",
3292
3326
  {
3293
3327
  allowNullableBoolean: true,
3294
- allowNullableObject: true
3328
+ allowNullableObject: true,
3329
+ allowNullableString: true,
3330
+ allowNullableEnum: true
3295
3331
  }
3296
3332
  ],
3297
3333
  "ts/switch-exhaustiveness-check": "error",
@@ -3347,9 +3383,14 @@ async function typescript(options = {}) {
3347
3383
  files,
3348
3384
  name: "storm/typescript/rules",
3349
3385
  rules: {
3350
- ...renameRules(pluginTs.configs["eslint-recommended"]?.overrides?.[0]?.rules, {
3351
- "@typescript-eslint": "ts"
3352
- }),
3386
+ ...renameRules(
3387
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
3388
+ pluginTs.configs["eslint-recommended"]?.overrides?.[0]?.rules,
3389
+ {
3390
+ "@typescript-eslint": "ts"
3391
+ }
3392
+ ),
3393
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
3353
3394
  ...renameRules(pluginTs.configs.strict?.rules, {
3354
3395
  "@typescript-eslint": "ts"
3355
3396
  }),
@@ -3444,6 +3485,7 @@ async function typescript(options = {}) {
3444
3485
  "ts/no-import-type-side-effects": "error",
3445
3486
  "ts/no-invalid-void-type": "off",
3446
3487
  "ts/no-non-null-assertion": "off",
3488
+ "ts/no-non-null-asserted-optional-chain": "error",
3447
3489
  "ts/no-redeclare": [
3448
3490
  "error",
3449
3491
  {
@@ -3505,10 +3547,10 @@ async function unicorn(options = {}) {
3505
3547
  {
3506
3548
  name: "storm/unicorn/rules",
3507
3549
  plugins: {
3508
- unicorn: default6
3550
+ unicorn: default7
3509
3551
  },
3510
3552
  rules: {
3511
- ...options.allRecommended ? default6.configs["recommended"].rules : {
3553
+ ...options.allRecommended ? default7.configs["recommended"].rules : {
3512
3554
  "unicorn/consistent-empty-array-spread": "error",
3513
3555
  "unicorn/error-message": "error",
3514
3556
  "unicorn/escape-case": "error",
@@ -3700,6 +3742,81 @@ async function mdx(options = {}) {
3700
3742
  }
3701
3743
  __name(mdx, "mdx");
3702
3744
 
3745
+ // src/configs/react-native.ts
3746
+ import { FlatCompat as FlatCompat3 } from "@eslint/eslintrc";
3747
+ var compat3 = new FlatCompat3({
3748
+ // import.meta.dirname is available after Node.js v20.11.0
3749
+ baseDirectory: import.meta.dirname
3750
+ });
3751
+ async function reactNative(options = {}) {
3752
+ const { overrides = {} } = options;
3753
+ await ensurePackages([
3754
+ "eslint-plugin-react-native"
3755
+ ]);
3756
+ const reactNative1 = await interopDefault(
3757
+ // eslint-disable-next-line @nx/enforce-module-boundaries
3758
+ import("eslint-plugin-react-native")
3759
+ );
3760
+ return [
3761
+ ...compat3.config({
3762
+ name: "storm/react-native/rules",
3763
+ parserOptions: {
3764
+ ecmaFeatures: {
3765
+ "jsx": true
3766
+ }
3767
+ },
3768
+ env: {
3769
+ "react-native/react-native": true
3770
+ },
3771
+ plugins: [
3772
+ "react-native"
3773
+ ],
3774
+ extends: [
3775
+ "plugin:react-native/all"
3776
+ ],
3777
+ rules: {
3778
+ ...reactNative1.configs.all.rules,
3779
+ ...overrides
3780
+ }
3781
+ })
3782
+ ];
3783
+ }
3784
+ __name(reactNative, "reactNative");
3785
+
3786
+ // src/configs/secrets.ts
3787
+ async function secrets(options) {
3788
+ const { json = true } = options;
3789
+ await ensurePackages([
3790
+ "eslint-plugin-jsonc"
3791
+ ]);
3792
+ const [pluginJsonc] = await Promise.all([
3793
+ interopDefault(import("eslint-plugin-jsonc"))
3794
+ ]);
3795
+ return [
3796
+ ...json ? pluginJsonc.configs["flat/recommended-with-jsonc"] : [],
3797
+ {
3798
+ name: "storm/secrets/rules",
3799
+ files: [
3800
+ `**/*.{js,ts,jsx,tsx${json ? ",json,jsonc" : ""}`
3801
+ ],
3802
+ plugins: {
3803
+ "no-secrets": default5
3804
+ },
3805
+ rules: {
3806
+ "no-secrets/no-secrets": [
3807
+ "error",
3808
+ {
3809
+ "ignoreIdentifiers": [
3810
+ "nxCloudId"
3811
+ ]
3812
+ }
3813
+ ]
3814
+ }
3815
+ }
3816
+ ];
3817
+ }
3818
+ __name(secrets, "secrets");
3819
+
3703
3820
  // src/preset.ts
3704
3821
  var flatConfigProps = [
3705
3822
  "name",
@@ -3732,7 +3849,7 @@ function getOverrides(options, key) {
3732
3849
  }
3733
3850
  __name(getOverrides, "getOverrides");
3734
3851
  function getStormConfig(options, ...userConfigs) {
3735
- const { name = "", globals = {}, lineEndings = "unix", astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, jsx: enableJsx = true, cspell: enableCSpell = true, react: enableReact = false, regexp: enableRegexp = true, next: enableNext = false, graphql: enableGraphQL = false, storybook: enableStorybook = false, typescript: enableTypeScript = isPackageExists2("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false } = options;
3852
+ const { name = "", globals = {}, lineEndings = "unix", astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, jsx: enableJsx = true, cspell: enableCSpell = true, react: enableReact = false, "react-native": enableReactNative = false, regexp: enableRegexp = true, next: enableNext = false, graphql: enableGraphQL = false, storybook: enableStorybook = false, typescript: enableTypeScript = isPackageExists2("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false } = options;
3736
3853
  let isInEditor = options.isInEditor;
3737
3854
  if (isInEditor == null) {
3738
3855
  isInEditor = isInEditorEnv();
@@ -3774,7 +3891,9 @@ function getStormConfig(options, ...userConfigs) {
3774
3891
  stylistic: stylisticOptions
3775
3892
  }), imports({
3776
3893
  stylistic: stylisticOptions
3777
- }), nx(resolveSubOptions(options, "nx")), perfectionist());
3894
+ }), nx(resolveSubOptions(options, "nx")), perfectionist(), secrets({
3895
+ json: options.jsonc !== false
3896
+ }));
3778
3897
  if (enableCSpell) {
3779
3898
  configs2.push(cspell(resolveSubOptions(options, "cspell")));
3780
3899
  }
@@ -3819,6 +3938,12 @@ function getStormConfig(options, ...userConfigs) {
3819
3938
  tsconfigPath
3820
3939
  }));
3821
3940
  }
3941
+ if (enableReactNative) {
3942
+ configs2.push(reactNative({
3943
+ ...resolveSubOptions(options, "react-native"),
3944
+ overrides: getOverrides(options, "react-native")
3945
+ }));
3946
+ }
3822
3947
  if (enableNext) {
3823
3948
  configs2.push(next(resolveSubOptions(options, "next")));
3824
3949
  }
@@ -3887,9 +4012,7 @@ function getStormConfig(options, ...userConfigs) {
3887
4012
  }
3888
4013
  if (isInEditor) {
3889
4014
  composer = composer.disableRulesFix([
3890
- "unused-imports/no-unused-imports",
3891
- "test/no-only-tests",
3892
- "prefer-const"
4015
+ "test/no-only-tests"
3893
4016
  ], {
3894
4017
  builtinRules: /* @__PURE__ */ __name(() => import([
3895
4018
  "eslint",
@@ -14639,7 +14639,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
14639
14639
  onlyEquality?: boolean
14640
14640
  }]
14641
14641
  // Names of all the configs
14642
- type ConfigNames = 'storm/astro/setup' | 'storm/astro/rules' | 'storm/formatter/setup' | 'storm/imports/rules' | 'storm/javascript/setup' | 'storm/javascript/banner' | 'storm/javascript/rules' | 'storm/jsx/rules' | 'storm/jsdoc/rules' | 'storm/jsonc/setup' | 'storm/jsonc/rules' | 'storm/markdown/setup' | 'storm/markdown/processor' | 'storm/markdown/parser' | 'storm/markdown/disables' | 'storm/node/rules' | 'storm/perfectionist/setup' | 'storm/react/setup' | 'storm/react/rules' | 'storm/sort/package-json' | 'storm/stylistic/rules' | 'storm/test/setup' | 'storm/test/rules' | 'storm/toml/setup' | 'storm/toml/rules' | 'storm/regexp/rules' | 'storm/typescript/setup' | 'storm/typescript/parser' | 'storm/typescript/type-aware-parser' | 'storm/typescript/rules' | 'storm/typescript/rules-type-aware' | 'storm/unicorn/rules' | 'storm/unocss' | 'storm/yaml/setup' | 'storm/yaml/rules'
14642
+ type ConfigNames = 'storm/astro/setup' | 'storm/astro/rules' | 'storm/formatter/setup' | 'storm/imports/rules' | 'storm/javascript/setup' | 'storm/javascript/banner' | 'storm/javascript/rules' | 'storm/jsx/rules' | 'storm/jsdoc/rules' | 'storm/jsonc/setup' | 'storm/jsonc/rules' | 'storm/markdown/setup' | 'storm/markdown/processor' | 'storm/markdown/parser' | 'storm/markdown/disables' | 'storm/node/rules' | 'storm/perfectionist/rules' | 'storm/react/setup' | 'storm/react/rules' | 'storm/sort/package-json' | 'storm/stylistic/rules' | 'storm/test/setup' | 'storm/test/rules' | 'storm/toml/setup' | 'storm/toml/rules' | 'storm/regexp/rules' | 'storm/typescript/setup' | 'storm/typescript/parser' | 'storm/typescript/type-aware-parser' | 'storm/typescript/rules' | 'storm/typescript/rules-type-aware' | 'storm/unicorn/rules' | 'storm/unocss' | 'storm/yaml/setup' | 'storm/yaml/rules'
14643
14643
 
14644
14644
  /**
14645
14645
  * Vendor types from Prettier so we don't rely on the dependency.
@@ -15209,6 +15209,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsJavascript, Options
15209
15209
  * Enable stylistic rules.
15210
15210
  *
15211
15211
  * @see https://eslint.style/
15212
+ *
15212
15213
  * @default true
15213
15214
  */
15214
15215
  stylistic?: boolean | (StylisticConfig & OptionsOverrides);
@@ -15242,6 +15243,15 @@ interface OptionsConfig extends OptionsComponentExts, OptionsJavascript, Options
15242
15243
  * @default false
15243
15244
  */
15244
15245
  react?: boolean | OptionsOverrides;
15246
+ /**
15247
+ * Enable react native rules.
15248
+ *
15249
+ * Requires installing:
15250
+ * - `eslint-plugin-react-native`
15251
+ *
15252
+ * @default false
15253
+ */
15254
+ "react-native"?: boolean | OptionsOverrides;
15245
15255
  /**
15246
15256
  * Enable next rules.
15247
15257
  *
@@ -1,5 +1,5 @@
1
1
  import { Awaitable } from 'eslint-flat-config-utils';
2
- import { T as TypedFlatConfigItem } from '../types-oCxTBmlp.js';
2
+ import { T as TypedFlatConfigItem } from '../types-CnDDaY3J.js';
3
3
  import '@nx/eslint-plugin/src/utils/runtime-lint-utils';
4
4
  import '@stylistic/eslint-plugin';
5
5
  import '@typescript-eslint/parser';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/eslint",
3
- "version": "0.126.0",
3
+ "version": "0.126.2",
4
4
  "type": "module",
5
5
  "description": "⚡ A package containing the base ESLint configuration used by Storm Software across many projects.",
6
6
  "repository": {
@@ -140,6 +140,7 @@
140
140
  "eslint-plugin-format": ">=0.1.0",
141
141
  "eslint-plugin-react-compiler": "19.0.0-beta-21e868a-20250216",
142
142
  "eslint-plugin-react-hooks": "^5.0.0",
143
+ "eslint-plugin-react-native": "^5.0.0",
143
144
  "eslint-plugin-react-refresh": "^0.4.4",
144
145
  "eslint-plugin-relay": "^1.8.3",
145
146
  "eslint-plugin-storybook": "^0.11.0",
@@ -175,6 +176,7 @@
175
176
  "eslint-plugin-mdx": "^3.1.5",
176
177
  "eslint-plugin-n": "^17.8.1",
177
178
  "eslint-plugin-no-only-tests": "^3.3.0",
179
+ "eslint-plugin-no-secrets": "^2.2.1",
178
180
  "eslint-plugin-perfectionist": "^4.9.0",
179
181
  "eslint-plugin-prettier": "^5.2.3",
180
182
  "eslint-plugin-regexp": "^2.7.0",
@@ -211,6 +213,7 @@
211
213
  "eslint-plugin-format": "^1.0.1",
212
214
  "eslint-plugin-react-compiler": "19.0.0-beta-21e868a-20250216",
213
215
  "eslint-plugin-react-hooks": "^5.1.0",
216
+ "eslint-plugin-react-native": "^5.0.0",
214
217
  "eslint-plugin-react-refresh": "^0.4.19",
215
218
  "eslint-plugin-relay": "^1.8.3",
216
219
  "eslint-plugin-storybook": "^0.11.0",