@storm-software/eslint 0.23.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/dist/preset.mjs CHANGED
@@ -1,15 +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';
11
- import prettierConfig from 'eslint-plugin-prettier/recommended';
12
- import { config as config$5, rules } from 'eslint-plugin-import';
10
+ import globals from 'globals';
11
+ import jsoncParser from 'jsonc-eslint-parser';
13
12
 
14
13
  function getDefaultExportFromCjs (x) {
15
14
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -332,23 +331,7 @@ var src = {
332
331
 
333
332
  const eslint = /*@__PURE__*/getDefaultExportFromCjs(src);
334
333
 
335
- const formatConfig = (name, config = []) => {
336
- return config.map((config2, index) => {
337
- if (!config2 || config2.name) {
338
- return config2 ?? {};
339
- }
340
- return {
341
- ...config2,
342
- name: `Storm Software (${name}) #${index + 1}`,
343
- settings: {
344
- "import/resolver": "node",
345
- ...config2.settings ?? {}
346
- }
347
- };
348
- });
349
- };
350
-
351
- const config$4 = {
334
+ const config$3 = {
352
335
  // This rule has been deprecated, but not yet removed.
353
336
  "jsx-a11y/no-onchange": "off",
354
337
  // ensure emoji are accessible
@@ -623,7 +606,7 @@ const config$4 = {
623
606
  "jsx-a11y/prefer-tag-over-role": "off"
624
607
  };
625
608
 
626
- const config$3 = {
609
+ const config$2 = {
627
610
  // We recommend using TypeScript over `prop-types`, as `prop-types` can add
628
611
  // to a project's build size.
629
612
  "react/prop-types": "off",
@@ -1188,7 +1171,7 @@ const config$3 = {
1188
1171
  ]
1189
1172
  };
1190
1173
 
1191
- const config$2 = {
1174
+ const config$1 = {
1192
1175
  // Enforce Rules of Hooks
1193
1176
  // https://github.com/facebook/react/blob/c11015ff4f610ac2924d1fc6d569a17657a404fd/packages/eslint-plugin-react-hooks/src/RulesOfHooks.js
1194
1177
  "react-hooks/rules-of-hooks": "error",
@@ -1197,7 +1180,7 @@ const config$2 = {
1197
1180
  "react-hooks/exhaustive-deps": "warn"
1198
1181
  };
1199
1182
 
1200
- const config$1 = {
1183
+ const config = {
1201
1184
  /**
1202
1185
  * Require TSDoc comments conform to the TSDoc specification.
1203
1186
  *
@@ -1206,296 +1189,26 @@ const config$1 = {
1206
1189
  "tsdoc/syntax": "error"
1207
1190
  };
1208
1191
 
1209
- const importEslint = {
1210
- meta: {
1211
- name: "eslint-plugin-import",
1212
- version: "2.29.1"
1213
- },
1214
- configs: {
1215
- ...config$5
1216
- },
1217
- rules: {
1218
- ...rules
1219
- },
1220
- processors: {}
1221
- };
1222
-
1223
- const config = {
1224
- /**
1225
- * Disallow non-import statements appearing before import statements.
1226
- *
1227
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
1228
- */
1229
- "import/first": "warn",
1230
- /**
1231
- * Require a newline after the last import/require.
1232
- *
1233
- * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
1234
- */
1235
- "import/newline-after-import": "warn",
1236
- /**
1237
- * Disallow import of modules using absolute paths.
1238
- *
1239
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
1240
- */
1241
- "import/no-absolute-path": "error",
1242
- /**
1243
- * Disallow default exports.
1244
- *
1245
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
1246
- */
1247
- "import/no-default-export": "error",
1248
- /**
1249
- * Disallow the use of extraneous packages.
1250
- *
1251
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
1252
- */
1253
- "import/no-extraneous-dependencies": [
1254
- "error",
1255
- { includeInternal: true, includeTypes: true }
1256
- ],
1257
- /**
1258
- * Disallow mutable exports.
1259
- *
1260
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
1261
- */
1262
- "import/no-mutable-exports": "error",
1263
- /**
1264
- * Disallow importing packages through relative paths.
1265
- *
1266
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
1267
- */
1268
- "import/no-relative-packages": "warn",
1269
- /**
1270
- * Disallow a module from importing itself.
1271
- *
1272
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
1273
- */
1274
- "import/no-self-import": "error",
1275
- /**
1276
- * Ensures that there are no useless path segments.
1277
- *
1278
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
1279
- */
1280
- "import/no-useless-path-segments": ["error"],
1281
- /**
1282
- * Enforce a module import order convention.
1283
- *
1284
- * 🔧 Fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
1285
- */
1286
- "import/order": [
1287
- "warn",
1288
- {
1289
- groups: [
1290
- "builtin",
1291
- // Node.js built-in modules
1292
- "external",
1293
- // Packages
1294
- "internal",
1295
- // Aliased modules
1296
- "parent",
1297
- // Relative parent
1298
- "sibling",
1299
- // Relative sibling
1300
- "index"
1301
- // Relative index
1302
- ],
1303
- "newlines-between": "never"
1304
- }
1305
- ],
1306
- "import/extensions": ["error", "ignorePackages"],
1307
- // Bob when bundling requires to have `.js` extension
1308
- "import/prefer-default-export": "off",
1309
- // disable opposite of 'import/no-default-export'
1310
- // Reports any imports that come after non-import statements
1311
- // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
1312
- "import/no-duplicates": "error",
1313
- // ensure imports point to files/modules that can be resolved
1314
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
1315
- "import/no-unresolved": "off",
1316
- // ensure named imports coupled with named exports
1317
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
1318
- "import/named": "error",
1319
- // ensure default import coupled with default export
1320
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
1321
- "import/default": "off",
1322
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/namespace.md
1323
- "import/namespace": "off",
1324
- // Helpful warnings:
1325
- // disallow invalid exports, e.g. multiple defaults
1326
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/export.md
1327
- "import/export": "error",
1328
- // do not allow a default import name to match a named export
1329
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
1330
- "import/no-named-as-default": "error",
1331
- // warn on accessing default export property names that are also named exports
1332
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
1333
- "import/no-named-as-default-member": "error",
1334
- // disallow use of jsdoc-marked-deprecated imports
1335
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
1336
- "import/no-deprecated": "off",
1337
- // Forbid the use of extraneous packages
1338
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
1339
- // paths are treated both as absolute paths, and relative to process.cwd()
1340
- // "import/no-extraneous-dependencies": [
1341
- // "error",
1342
- // {
1343
- // devDependencies: [
1344
- // "test/**", // tape, common npm pattern
1345
- // "tests/**", // also common npm pattern
1346
- // "spec/**", // mocha, rspec-like pattern
1347
- // "**/__tests__/**", // jest pattern
1348
- // "**/__mocks__/**", // jest pattern
1349
- // "test.{js,jsx}", // repos with a single test file
1350
- // "test-*.{js,jsx}", // repos with multiple top-level test files
1351
- // "**/*{.,_}{test,spec}.{js,jsx}", // tests where the extension or filename suffix denotes that it is a test
1352
- // "**/jest.config.js", // jest config
1353
- // "**/jest.setup.js", // jest setup
1354
- // "**/vue.config.js", // vue-cli config
1355
- // "**/webpack.config.js", // webpack config
1356
- // "**/webpack.config.*.js", // webpack config
1357
- // "**/rollup.config.js", // rollup config
1358
- // "**/rollup.config.*.js", // rollup config
1359
- // "**/gulpfile.js", // gulp config
1360
- // "**/gulpfile.*.js", // gulp config
1361
- // "**/Gruntfile{,.js}", // grunt config
1362
- // "**/protractor.conf.js", // protractor config
1363
- // "**/protractor.conf.*.js", // protractor config
1364
- // "**/karma.conf.js", // karma config
1365
- // "**/.eslintrc.js" // eslint config
1366
- // ],
1367
- // optionalDependencies: false
1368
- // }
1369
- // ],
1370
- // Module systems:
1371
- // disallow require()
1372
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
1373
- "import/no-commonjs": "off",
1374
- // disallow AMD require/define
1375
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-amd.md
1376
- "import/no-amd": "error",
1377
- // No Node.js builtin modules
1378
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
1379
- // TODO: enable?
1380
- "import/no-nodejs-modules": "off",
1381
- // Style guide:
1382
- // disallow non-import statements appearing before import statements
1383
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/imports-first.md
1384
- // deprecated: use `import/first`
1385
- "import/imports-first": "off",
1386
- // disallow namespace imports
1387
- // TODO: enable?
1388
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
1389
- "import/no-namespace": "off",
1390
- // Restrict which files can be imported in a given folder
1391
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
1392
- "import/no-restricted-paths": "off",
1393
- // Forbid modules to have too many dependencies
1394
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
1395
- "import/max-dependencies": ["warn", { max: 50 }],
1396
- // Forbid require() calls with expressions
1397
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
1398
- "import/no-dynamic-require": "error",
1399
- // prevent importing the submodules of other modules
1400
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
1401
- "import/no-internal-modules": [
1402
- "off",
1403
- {
1404
- allow: []
1405
- }
1406
- ],
1407
- // Warn if a module could be mistakenly parsed as a script by a consumer
1408
- // leveraging Unambiguous JavaScript Grammar
1409
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
1410
- // this should not be enabled until this proposal has at least been *presented* to TC39.
1411
- // At the moment, it's not a thing.
1412
- "import/unambiguous": "off",
1413
- // Forbid Webpack loader syntax in imports
1414
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
1415
- "import/no-webpack-loader-syntax": "error",
1416
- // Prevent unassigned imports
1417
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
1418
- // importing for side effects is perfectly acceptable, if you need side effects.
1419
- "import/no-unassigned-import": "off",
1420
- // Prevent importing the default as if it were named
1421
- // https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
1422
- "import/no-named-default": "error",
1423
- // Reports if a module's default export is unnamed
1424
- // https://github.com/import-js/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
1425
- "import/no-anonymous-default-export": [
1426
- "off",
1427
- {
1428
- allowArray: false,
1429
- allowArrowFunction: false,
1430
- allowAnonymousClass: false,
1431
- allowAnonymousFunction: false,
1432
- allowLiteral: false,
1433
- allowObject: false
1434
- }
1435
- ],
1436
- // This rule enforces that all exports are declared at the bottom of the file.
1437
- // https://github.com/import-js/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md
1438
- // TODO: enable?
1439
- "import/exports-last": "off",
1440
- // Reports when named exports are not grouped together in a single export declaration
1441
- // or when multiple assignments to CommonJS module.exports or exports object are present
1442
- // in a single file.
1443
- // https://github.com/import-js/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
1444
- "import/group-exports": "off",
1445
- // Prohibit named exports. this is a terrible rule, do not use it.
1446
- // https://github.com/import-js/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
1447
- "import/no-named-export": "off",
1448
- /**
1449
- * Disallow cyclical dependencies between modules.
1450
- *
1451
- * 🚫 Not fixable - https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
1452
- */
1453
- "import/no-cycle": ["error", { maxDepth: "\u221E" }],
1454
- // dynamic imports require a leading comment with a webpackChunkName
1455
- // https://github.com/import-js/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md
1456
- "import/dynamic-import-chunkname": [
1457
- "off",
1458
- {
1459
- importFunctions: [],
1460
- webpackChunknameFormat: "[0-9a-zA-Z-_/.]+"
1461
- }
1462
- ],
1463
- // Use this rule to prevent imports to folders in relative parent paths.
1464
- // https://github.com/import-js/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md
1465
- "import/no-relative-parent-imports": "off",
1466
- // Reports modules without any exports, or with unused exports
1467
- // https://github.com/import-js/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md
1468
- // TODO: enable once it supports CJS
1469
- "import/no-unused-modules": [
1470
- "off",
1471
- {
1472
- ignoreExports: [],
1473
- missingExports: true,
1474
- unusedExports: true
1475
- }
1476
- ],
1477
- // Reports the use of import declarations with CommonJS exports in any module except for the main module.
1478
- // https://github.com/import-js/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md
1479
- "import/no-import-module-exports": [
1480
- "error",
1481
- {
1482
- exceptions: []
1483
- }
1484
- ],
1485
- // enforce a consistent style for type specifiers (inline or top-level)
1486
- // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/consistent-type-specifier-style.md
1487
- // TODO, semver-major: enable (just in case)
1488
- "import/consistent-type-specifier-style": ["off", "prefer-inline"],
1489
- // Reports the use of empty named import blocks.
1490
- // https://github.com/import-js/eslint-plugin-import/blob/d5fc8b670dc8e6903dbb7b0894452f60c03089f5/docs/rules/no-empty-named-blocks.md
1491
- // TODO, semver-minor: enable
1492
- "import/no-empty-named-blocks": "off"
1493
- };
1494
-
1495
1192
  const CODE_BLOCK = "**/*.md{,x}/*";
1496
1193
  const CODE_FILE = "**/*.{,c,m}{j,t}s{,x}";
1497
1194
  const TS_FILE = "**/*.{,c,m}ts{,x}";
1498
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
+
1499
1212
  function stormPreset(options = {
1500
1213
  moduleBoundaries: {
1501
1214
  enforceBuildableLibDependency: true,
@@ -1584,25 +1297,25 @@ function stormPreset(options = {
1584
1297
  options.react !== false && {
1585
1298
  files: [CODE_FILE],
1586
1299
  rules: {
1587
- ...config$3,
1588
1300
  ...config$2,
1589
- ...config$4,
1301
+ ...config$1,
1302
+ ...config$3,
1590
1303
  ...options.react?.rules
1591
1304
  }
1592
1305
  },
1593
1306
  // Import
1594
1307
  // https://www.npmjs.com/package/eslint-plugin-import
1595
- { plugins: { import: importEslint } },
1596
- {
1597
- files: [CODE_FILE],
1598
- rules: config
1599
- },
1308
+ // { plugins: { import: importEslint } },
1309
+ // {
1310
+ // files: [CODE_FILE],
1311
+ // rules: importRules
1312
+ // },
1600
1313
  // TSDoc
1601
1314
  // https://www.npmjs.com/package/eslint-plugin-tsdoc
1602
1315
  { plugins: { tsdoc } },
1603
1316
  {
1604
1317
  files: [TS_FILE],
1605
- rules: config$1
1318
+ rules: config
1606
1319
  },
1607
1320
  // Nx plugin
1608
1321
  { plugins: { "@nx": nxPlugin } },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/eslint",
3
- "version": "0.23.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": {