@storm-software/eslint 0.22.0 → 0.24.0

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/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.21.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.24.0-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/dist/preset.d.mts CHANGED
@@ -978,6 +978,10 @@ interface RuleOptions {
978
978
  * @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/tabindex-no-positive.md
979
979
  */
980
980
  'jsx-a11y/tabindex-no-positive'?: Linter.RuleEntry<JsxA11yTabindexNoPositive>
981
+ /**
982
+ * @see https://github.com/prettier/eslint-plugin-prettier#options
983
+ */
984
+ 'prettier/prettier'?: Linter.RuleEntry<PrettierPrettier>
981
985
  /**
982
986
  * verifies the list of dependencies for Hooks like useEffect and similar
983
987
  * @see https://github.com/facebook/react/issues/14920
@@ -3723,6 +3727,18 @@ type TypescriptEslintUnifiedSignatures = []|[{
3723
3727
 
3724
3728
  ignoreDifferentlyNamedParameters?: boolean
3725
3729
  }]
3730
+ // ----- prettier/prettier -----
3731
+ type PrettierPrettier = []|[{
3732
+ [k: string]: unknown | undefined
3733
+ }]|[{
3734
+ [k: string]: unknown | undefined
3735
+ }, {
3736
+ usePrettierrc?: boolean
3737
+ fileInfoOptions?: {
3738
+ [k: string]: unknown | undefined
3739
+ }
3740
+ [k: string]: unknown | undefined
3741
+ }]
3726
3742
  // ----- react-hooks/exhaustive-deps -----
3727
3743
  type ReactHooksExhaustiveDeps = []|[{
3728
3744
  additionalHooks?: string
package/dist/preset.d.ts CHANGED
@@ -978,6 +978,10 @@ interface RuleOptions {
978
978
  * @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/tabindex-no-positive.md
979
979
  */
980
980
  'jsx-a11y/tabindex-no-positive'?: Linter.RuleEntry<JsxA11yTabindexNoPositive>
981
+ /**
982
+ * @see https://github.com/prettier/eslint-plugin-prettier#options
983
+ */
984
+ 'prettier/prettier'?: Linter.RuleEntry<PrettierPrettier>
981
985
  /**
982
986
  * verifies the list of dependencies for Hooks like useEffect and similar
983
987
  * @see https://github.com/facebook/react/issues/14920
@@ -3723,6 +3727,18 @@ type TypescriptEslintUnifiedSignatures = []|[{
3723
3727
 
3724
3728
  ignoreDifferentlyNamedParameters?: boolean
3725
3729
  }]
3730
+ // ----- prettier/prettier -----
3731
+ type PrettierPrettier = []|[{
3732
+ [k: string]: unknown | undefined
3733
+ }]|[{
3734
+ [k: string]: unknown | undefined
3735
+ }, {
3736
+ usePrettierrc?: boolean
3737
+ fileInfoOptions?: {
3738
+ [k: string]: unknown | undefined
3739
+ }
3740
+ [k: string]: unknown | undefined
3741
+ }]
3726
3742
  // ----- react-hooks/exhaustive-deps -----
3727
3743
  type ReactHooksExhaustiveDeps = []|[{
3728
3744
  additionalHooks?: string
package/dist/preset.mjs CHANGED
@@ -1,13 +1,14 @@
1
1
  import tsEslint from 'typescript-eslint';
2
2
  import eslintPluginUnicorn from 'eslint-plugin-unicorn';
3
- import markdown from 'eslint-plugin-markdown';
4
- import globals from 'globals';
5
3
  import nxPlugin from '@nx/eslint-plugin';
6
- import jsoncParser from 'jsonc-eslint-parser';
7
- import react from 'eslint-plugin-react';
8
4
  import jsxA11y from 'eslint-plugin-jsx-a11y';
5
+ import markdown from 'eslint-plugin-markdown';
6
+ import prettierConfig from 'eslint-plugin-prettier/recommended';
7
+ import react from 'eslint-plugin-react';
9
8
  import reactHooks from 'eslint-plugin-react-hooks';
10
9
  import tsdoc from 'eslint-plugin-tsdoc';
10
+ import globals from 'globals';
11
+ import jsoncParser from 'jsonc-eslint-parser';
11
12
 
12
13
  function getDefaultExportFromCjs (x) {
13
14
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -330,22 +331,6 @@ var src = {
330
331
 
331
332
  const eslint = /*@__PURE__*/getDefaultExportFromCjs(src);
332
333
 
333
- const formatConfig = (name, config = []) => {
334
- return config.map((config2, index) => {
335
- if (!config2 || config2.name) {
336
- return config2 ?? {};
337
- }
338
- return {
339
- ...config2,
340
- name: `Storm Software (${name}) #${index + 1}`,
341
- settings: {
342
- "import/resolver": "node",
343
- ...config2.settings ?? {}
344
- }
345
- };
346
- });
347
- };
348
-
349
334
  const config$3 = {
350
335
  // This rule has been deprecated, but not yet removed.
351
336
  "jsx-a11y/no-onchange": "off",
@@ -1204,6 +1189,26 @@ const config = {
1204
1189
  "tsdoc/syntax": "error"
1205
1190
  };
1206
1191
 
1192
+ const CODE_BLOCK = "**/*.md{,x}/*";
1193
+ const CODE_FILE = "**/*.{,c,m}{j,t}s{,x}";
1194
+ const TS_FILE = "**/*.{,c,m}ts{,x}";
1195
+
1196
+ const formatConfig = (name, config = []) => {
1197
+ return config.map((config2, index) => {
1198
+ if (!config2 || config2.name) {
1199
+ return config2 ?? {};
1200
+ }
1201
+ return {
1202
+ ...config2,
1203
+ name: `Storm Software (${name}) #${index + 1}`,
1204
+ settings: {
1205
+ "import/resolver": "node",
1206
+ ...config2.settings ?? {}
1207
+ }
1208
+ };
1209
+ });
1210
+ };
1211
+
1207
1212
  function stormPreset(options = {
1208
1213
  moduleBoundaries: {
1209
1214
  enforceBuildableLibDependency: true,
@@ -1246,6 +1251,8 @@ function stormPreset(options = {
1246
1251
  ...tsEslint.configs.recommended,
1247
1252
  // https://github.com/sindresorhus/eslint-plugin-unicorn
1248
1253
  eslintPluginUnicorn.configs["flat/recommended"],
1254
+ // Prettier
1255
+ prettierConfig,
1249
1256
  // Preset overrides
1250
1257
  { rules },
1251
1258
  {
@@ -1265,7 +1272,7 @@ function stormPreset(options = {
1265
1272
  // https://www.npmjs.com/package/eslint-plugin-markdown
1266
1273
  options.markdown !== false && { plugins: { markdown } },
1267
1274
  options.markdown !== false && {
1268
- files: ["*.md"],
1275
+ files: [CODE_BLOCK],
1269
1276
  processor: "markdown/markdown"
1270
1277
  },
1271
1278
  options.markdown !== false && {
@@ -1288,7 +1295,7 @@ function stormPreset(options = {
1288
1295
  plugins: { react, "react-hooks": reactHooks, "jsx-a11y": jsxA11y }
1289
1296
  },
1290
1297
  options.react !== false && {
1291
- files: ["*.ts", "*.tsx", "*.js", "*.jsx"],
1298
+ files: [CODE_FILE],
1292
1299
  rules: {
1293
1300
  ...config$2,
1294
1301
  ...config$1,
@@ -1296,14 +1303,19 @@ function stormPreset(options = {
1296
1303
  ...options.react?.rules
1297
1304
  }
1298
1305
  },
1306
+ // Import
1307
+ // https://www.npmjs.com/package/eslint-plugin-import
1308
+ // { plugins: { import: importEslint } },
1309
+ // {
1310
+ // files: [CODE_FILE],
1311
+ // rules: importRules
1312
+ // },
1299
1313
  // TSDoc
1300
1314
  // https://www.npmjs.com/package/eslint-plugin-tsdoc
1301
1315
  { plugins: { tsdoc } },
1302
1316
  {
1303
- files: ["*.ts", "*.tsx"],
1304
- rules: {
1305
- ...config
1306
- }
1317
+ files: [TS_FILE],
1318
+ rules: config
1307
1319
  },
1308
1320
  // Nx plugin
1309
1321
  { plugins: { "@nx": nxPlugin } },
@@ -1316,15 +1328,7 @@ function stormPreset(options = {
1316
1328
  },
1317
1329
  rules: {
1318
1330
  "@typescript-eslint/explicit-module-boundary-types": "off",
1319
- "@typescript-eslint/explicit-function-return-type": [
1320
- "warn",
1321
- {
1322
- allowExpressions: true,
1323
- allowConciseArrowFunctionExpressionsStartingWithVoid: true,
1324
- allowFunctionsWithoutTypeParameters: true,
1325
- allowIIFEs: true
1326
- }
1327
- ]
1331
+ "@typescript-eslint/explicit-function-return-type": "off"
1328
1332
  }
1329
1333
  },
1330
1334
  {
@@ -1335,12 +1339,13 @@ function stormPreset(options = {
1335
1339
  rules: {}
1336
1340
  },
1337
1341
  {
1338
- files: ["*.ts", "*.tsx", "*.js", "*.jsx"],
1342
+ files: [CODE_FILE],
1339
1343
  rules: {
1340
1344
  "@nx/enforce-module-boundaries": [
1341
1345
  "error",
1342
1346
  options.moduleBoundaries ? options.moduleBoundaries : {
1343
1347
  enforceBuildableLibDependency: true,
1348
+ checkDynamicDependenciesExceptions: [".*"],
1344
1349
  allow: [],
1345
1350
  depConstraints: [
1346
1351
  {
@@ -1349,6 +1354,22 @@ function stormPreset(options = {
1349
1354
  }
1350
1355
  ]
1351
1356
  }
1357
+ ],
1358
+ "no-restricted-imports": ["error", "create-nx-workspace"],
1359
+ "@typescript-eslint/no-restricted-imports": [
1360
+ "error",
1361
+ {
1362
+ "patterns": [
1363
+ {
1364
+ "group": ["nx/src/plugins/js*"],
1365
+ "message": "Imports from 'nx/src/plugins/js' are not allowed. Use '@nx/js' instead"
1366
+ },
1367
+ {
1368
+ "group": ["**/native-bindings", "**/native-bindings.js", ""],
1369
+ "message": "Direct imports from native-bindings.js are not allowed. Import from index.js instead."
1370
+ }
1371
+ ]
1372
+ }
1352
1373
  ]
1353
1374
  }
1354
1375
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/eslint",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "type": "module",
5
5
  "description": "⚡ A package containing the base ESLint configuration used by Storm Software across many projects.",
6
6
  "repository": {
@@ -69,12 +69,14 @@
69
69
  "@graphql-eslint/eslint-plugin": "3.20.1",
70
70
  "@next/eslint-plugin-next": "14.2.4",
71
71
  "eslint-plugin-es-x": "7.6.0",
72
+ "eslint-plugin-import": "^2.29.1",
72
73
  "eslint-plugin-jsonc": "2.16.0",
73
74
  "eslint-plugin-jsx-a11y": "6.8.0",
74
75
  "eslint-plugin-markdown": "^5.1.0",
75
76
  "eslint-plugin-markdownlint": "0.6.0",
76
77
  "eslint-plugin-mdx": "3.1.5",
77
78
  "eslint-plugin-n": "17.8.1",
79
+ "eslint-plugin-prettier": "^5.0.0",
78
80
  "eslint-plugin-promise": "6.2.0",
79
81
  "eslint-plugin-react": "7.34.3",
80
82
  "eslint-plugin-react-hooks": "4.6.2",