@will-stone/eslint-config 0.7.2 → 0.7.3

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 (2) hide show
  1. package/dist/index.cjs +59 -90
  2. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -1,78 +1,42 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- default: () => factory
34
- });
35
- module.exports = __toCommonJS(src_exports);
36
-
37
- // src/factory.ts
38
- var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/factory.ts
2
+ var _eslintconfigflatgitignore = require('eslint-config-flat-gitignore'); var _eslintconfigflatgitignore2 = _interopRequireDefault(_eslintconfigflatgitignore);
39
3
 
40
4
  // src/configs/astro.ts
41
- var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
42
- var import_astro_eslint_parser = __toESM(require("astro-eslint-parser"), 1);
43
- var import_eslint_plugin_astro = __toESM(require("eslint-plugin-astro"), 1);
5
+ var _parser = require('@typescript-eslint/parser'); var _parser2 = _interopRequireDefault(_parser);
6
+ var _astroeslintparser = require('astro-eslint-parser'); var _astroeslintparser2 = _interopRequireDefault(_astroeslintparser);
7
+ var _eslintpluginastro = require('eslint-plugin-astro'); var _eslintpluginastro2 = _interopRequireDefault(_eslintpluginastro);
44
8
  function astro() {
45
9
  return [
46
10
  {
47
11
  files: ["**/*.astro"],
48
12
  languageOptions: {
49
13
  // @ts-expect-error -- does not confirm to type
50
- parser: import_astro_eslint_parser.default,
14
+ parser: _astroeslintparser2.default,
51
15
  parserOptions: {
52
16
  extraFileExtensions: [".astro"],
53
- parser: import_parser.default
17
+ parser: _parser2.default
54
18
  }
55
19
  },
56
20
  plugins: {
57
21
  // @ts-expect-error -- does not confirm to type
58
- astro: import_eslint_plugin_astro.default
22
+ astro: _eslintpluginastro2.default
59
23
  },
60
24
  // @ts-expect-error -- does not confirm to type
61
- rules: import_eslint_plugin_astro.configs.recommended.rules
25
+ rules: _eslintpluginastro.configs.recommended.rules
62
26
  }
63
27
  ];
64
28
  }
65
29
 
66
30
  // src/configs/base.ts
67
- var import_confusing_browser_globals = __toESM(require("confusing-browser-globals"), 1);
68
- var import_globals = __toESM(require("globals"), 1);
31
+ var _confusingbrowserglobals = require('confusing-browser-globals'); var _confusingbrowserglobals2 = _interopRequireDefault(_confusingbrowserglobals);
32
+ var _globals = require('globals'); var _globals2 = _interopRequireDefault(_globals);
69
33
  function base() {
70
34
  return [
71
35
  {
72
36
  languageOptions: {
73
37
  globals: {
74
- ...import_globals.default.browser,
75
- ...import_globals.default.es2021
38
+ ..._globals2.default.browser,
39
+ ..._globals2.default.es2021
76
40
  }
77
41
  },
78
42
  rules: {
@@ -506,7 +470,7 @@ function base() {
506
470
  // No export names are restricted
507
471
  "no-restricted-exports": "off",
508
472
  // Global variable names that are dangerous to use by mistake
509
- "no-restricted-globals": ["error", ...import_confusing_browser_globals.default],
473
+ "no-restricted-globals": ["error", ..._confusingbrowserglobals2.default],
510
474
  // No imports are restricted
511
475
  "no-restricted-imports": "off",
512
476
  // No properties are restricted
@@ -773,14 +737,14 @@ function ignores() {
773
737
  }
774
738
 
775
739
  // src/configs/imports.ts
776
- var pluginImport = __toESM(require("eslint-plugin-i"), 1);
777
- var import_eslint_plugin_simple_import_sort = __toESM(require("eslint-plugin-simple-import-sort"), 1);
740
+ var _eslintplugini = require('eslint-plugin-i'); var pluginImport = _interopRequireWildcard(_eslintplugini);
741
+ var _eslintpluginsimpleimportsort = require('eslint-plugin-simple-import-sort'); var _eslintpluginsimpleimportsort2 = _interopRequireDefault(_eslintpluginsimpleimportsort);
778
742
  function imports() {
779
743
  return [
780
744
  {
781
745
  plugins: {
782
746
  "import": pluginImport,
783
- "simple-import-sort": import_eslint_plugin_simple_import_sort.default
747
+ "simple-import-sort": _eslintpluginsimpleimportsort2.default
784
748
  },
785
749
  rules: {
786
750
  // Prefer inline types
@@ -849,20 +813,20 @@ function imports() {
849
813
  }
850
814
 
851
815
  // src/configs/jest.ts
852
- var import_eslint_plugin_jest = __toESM(require("eslint-plugin-jest"), 1);
853
- var import_globals2 = __toESM(require("globals"), 1);
816
+ var _eslintpluginjest = require('eslint-plugin-jest'); var _eslintpluginjest2 = _interopRequireDefault(_eslintpluginjest);
817
+
854
818
  function jest() {
855
819
  return [
856
820
  {
857
821
  files: ["**/__mocks__/**/*", "**/*.{spec,test}.{js,cjs,mjs,jsx,ts,tsx}"],
858
822
  languageOptions: {
859
- globals: import_globals2.default.jest
823
+ globals: _globals2.default.jest
860
824
  }
861
825
  },
862
826
  {
863
827
  files: ["**/*.{spec,test}.{js,cjs,mjs,jsx,ts,tsx}"],
864
828
  plugins: {
865
- jest: import_eslint_plugin_jest.default
829
+ jest: _eslintpluginjest2.default
866
830
  },
867
831
  rules: {
868
832
  // Consistent test function names
@@ -969,16 +933,16 @@ function jest() {
969
933
  }
970
934
 
971
935
  // src/configs/node.ts
972
- var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
973
- var import_globals3 = __toESM(require("globals"), 1);
936
+ var _eslintpluginn = require('eslint-plugin-n'); var _eslintpluginn2 = _interopRequireDefault(_eslintpluginn);
937
+
974
938
  function node() {
975
939
  return [
976
940
  {
977
941
  languageOptions: {
978
- globals: import_globals3.default.node
942
+ globals: _globals2.default.node
979
943
  },
980
944
  plugins: {
981
- n: import_eslint_plugin_n.default
945
+ n: _eslintpluginn2.default
982
946
  },
983
947
  rules: {
984
948
  // Enforces return statements in callbacks of array's methods
@@ -1042,12 +1006,12 @@ function node() {
1042
1006
  }
1043
1007
 
1044
1008
  // src/configs/prettier.ts
1045
- var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
1009
+ var _eslintpluginprettier = require('eslint-plugin-prettier'); var _eslintpluginprettier2 = _interopRequireDefault(_eslintpluginprettier);
1046
1010
  function prettier() {
1047
1011
  return [
1048
1012
  {
1049
1013
  plugins: {
1050
- prettier: import_eslint_plugin_prettier.default
1014
+ prettier: _eslintpluginprettier2.default
1051
1015
  },
1052
1016
  rules: {
1053
1017
  "prettier/prettier": "warn"
@@ -1057,16 +1021,16 @@ function prettier() {
1057
1021
  }
1058
1022
 
1059
1023
  // src/configs/react.ts
1060
- var import_eslint_plugin_jsx_a11y = __toESM(require("eslint-plugin-jsx-a11y"), 1);
1061
- var import_eslint_plugin_react = __toESM(require("eslint-plugin-react"), 1);
1062
- var import_eslint_plugin_react_hooks = __toESM(require("eslint-plugin-react-hooks"), 1);
1063
- var import_globals4 = __toESM(require("globals"), 1);
1024
+ var _eslintpluginjsxa11y = require('eslint-plugin-jsx-a11y'); var _eslintpluginjsxa11y2 = _interopRequireDefault(_eslintpluginjsxa11y);
1025
+ var _eslintpluginreact = require('eslint-plugin-react'); var _eslintpluginreact2 = _interopRequireDefault(_eslintpluginreact);
1026
+ var _eslintpluginreacthooks = require('eslint-plugin-react-hooks'); var _eslintpluginreacthooks2 = _interopRequireDefault(_eslintpluginreacthooks);
1027
+
1064
1028
  function react() {
1065
1029
  return [
1066
1030
  {
1067
1031
  files: ["**/*.{jsx,tsx}"],
1068
1032
  languageOptions: {
1069
- globals: import_globals4.default.browser,
1033
+ globals: _globals2.default.browser,
1070
1034
  parserOptions: {
1071
1035
  ecmaFeatures: {
1072
1036
  jsx: true
@@ -1074,9 +1038,9 @@ function react() {
1074
1038
  }
1075
1039
  },
1076
1040
  plugins: {
1077
- "jsx-a11y": import_eslint_plugin_jsx_a11y.default,
1078
- "react": import_eslint_plugin_react.default,
1079
- "react-hooks": import_eslint_plugin_react_hooks.default
1041
+ "jsx-a11y": _eslintpluginjsxa11y2.default,
1042
+ "react": _eslintpluginreact2.default,
1043
+ "react-hooks": _eslintpluginreacthooks2.default
1080
1044
  },
1081
1045
  rules: {
1082
1046
  "jsx-a11y/alt-text": "error",
@@ -1381,12 +1345,12 @@ function react() {
1381
1345
  }
1382
1346
 
1383
1347
  // src/configs/switch-case.ts
1384
- var import_eslint_plugin_switch_case = __toESM(require("eslint-plugin-switch-case"), 1);
1348
+ var _eslintpluginswitchcase = require('eslint-plugin-switch-case'); var _eslintpluginswitchcase2 = _interopRequireDefault(_eslintpluginswitchcase);
1385
1349
  function switchCase() {
1386
1350
  return [
1387
1351
  {
1388
1352
  plugins: {
1389
- "switch-case": import_eslint_plugin_switch_case.default
1353
+ "switch-case": _eslintpluginswitchcase2.default
1390
1354
  },
1391
1355
  rules: {
1392
1356
  // Switches must have new lines between case groups
@@ -1403,19 +1367,19 @@ function switchCase() {
1403
1367
  }
1404
1368
 
1405
1369
  // src/configs/typescript.ts
1406
- var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
1407
- var import_parser2 = __toESM(require("@typescript-eslint/parser"), 1);
1370
+ var _eslintplugin = require('@typescript-eslint/eslint-plugin'); var _eslintplugin2 = _interopRequireDefault(_eslintplugin);
1371
+
1408
1372
  function typescript() {
1409
1373
  return [
1410
1374
  {
1411
1375
  files: ["**/*.{ts,tsx,astro}"],
1412
1376
  languageOptions: {
1413
1377
  // @ts-expect-error -- does not confirm to type
1414
- parser: import_parser2.default
1378
+ parser: _parser2.default
1415
1379
  },
1416
1380
  plugins: {
1417
1381
  // @ts-expect-error -- does not confirm to type
1418
- "@typescript-eslint": import_eslint_plugin.default
1382
+ "@typescript-eslint": _eslintplugin2.default
1419
1383
  },
1420
1384
  rules: {
1421
1385
  /**
@@ -1718,12 +1682,12 @@ function typescript() {
1718
1682
  }
1719
1683
 
1720
1684
  // src/configs/unicorn.ts
1721
- var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
1685
+ var _eslintpluginunicorn = require('eslint-plugin-unicorn'); var _eslintpluginunicorn2 = _interopRequireDefault(_eslintpluginunicorn);
1722
1686
  function unicorn() {
1723
1687
  return [
1724
1688
  {
1725
1689
  plugins: {
1726
- unicorn: import_eslint_plugin_unicorn.default
1690
+ unicorn: _eslintpluginunicorn2.default
1727
1691
  },
1728
1692
  rules: {
1729
1693
  // This rule is superseded by the unicorn version below
@@ -2010,44 +1974,44 @@ function unicorn() {
2010
1974
  }
2011
1975
 
2012
1976
  // src/utils.ts
2013
- var import_node_fs = require("fs");
2014
- var import_glob = require("glob");
1977
+ var _fs = require('fs');
1978
+ var _glob = require('glob');
2015
1979
  function loadJsonFileSync(filePath) {
2016
- const buffer = (0, import_node_fs.readFileSync)(filePath);
1980
+ const buffer = _fs.readFileSync.call(void 0, filePath);
2017
1981
  const data = new TextDecoder().decode(buffer);
2018
1982
  return JSON.parse(data);
2019
1983
  }
2020
1984
  function checkEnvironment() {
2021
- const isGitIgnore = (0, import_node_fs.existsSync)(".gitignore");
1985
+ const isGitIgnore = _fs.existsSync.call(void 0, ".gitignore");
2022
1986
  let isNodeEngine = false;
2023
1987
  let isPrettier = false;
2024
1988
  let isTailwind = false;
2025
1989
  let testingFramework = null;
2026
- const allPackageJsonPaths = (0, import_glob.globSync)("**/package.json", {
1990
+ const allPackageJsonPaths = _glob.globSync.call(void 0, "**/package.json", {
2027
1991
  ignore: "**/node_modules/**"
2028
1992
  });
2029
1993
  for (const packageJsonPath of allPackageJsonPaths) {
2030
1994
  const packageJson = loadJsonFileSync(packageJsonPath);
2031
1995
  if (!testingFramework && Boolean(
2032
- packageJson.dependencies?.jest || packageJson.devDependencies?.jest
1996
+ _optionalChain([packageJson, 'access', _ => _.dependencies, 'optionalAccess', _2 => _2.jest]) || _optionalChain([packageJson, 'access', _3 => _3.devDependencies, 'optionalAccess', _4 => _4.jest])
2033
1997
  )) {
2034
1998
  testingFramework = "jest";
2035
1999
  }
2036
- if (!isNodeEngine && Boolean(packageJson.engines?.node)) {
2000
+ if (!isNodeEngine && Boolean(_optionalChain([packageJson, 'access', _5 => _5.engines, 'optionalAccess', _6 => _6.node]))) {
2037
2001
  isNodeEngine = true;
2038
2002
  }
2039
2003
  if (!isPrettier && Boolean(
2040
- packageJson.dependencies?.prettier || packageJson.devDependencies?.prettier
2004
+ _optionalChain([packageJson, 'access', _7 => _7.dependencies, 'optionalAccess', _8 => _8.prettier]) || _optionalChain([packageJson, 'access', _9 => _9.devDependencies, 'optionalAccess', _10 => _10.prettier])
2041
2005
  )) {
2042
2006
  isPrettier = true;
2043
2007
  }
2044
2008
  if (!isTailwind && Boolean(
2045
- packageJson.dependencies?.tailwindcss || packageJson.devDependencies?.tailwindcss
2009
+ _optionalChain([packageJson, 'access', _11 => _11.dependencies, 'optionalAccess', _12 => _12.tailwindcss]) || _optionalChain([packageJson, 'access', _13 => _13.devDependencies, 'optionalAccess', _14 => _14.tailwindcss])
2046
2010
  )) {
2047
2011
  isTailwind = true;
2048
2012
  }
2049
2013
  }
2050
- const isNode = isNodeEngine || (0, import_node_fs.existsSync)(".nvmrc") || (0, import_node_fs.existsSync)(".node-version");
2014
+ const isNode = isNodeEngine || _fs.existsSync.call(void 0, ".nvmrc") || _fs.existsSync.call(void 0, ".node-version");
2051
2015
  return {
2052
2016
  isGitIgnore,
2053
2017
  isNode,
@@ -2062,7 +2026,7 @@ function factory() {
2062
2026
  const { isGitIgnore, isNode, isPrettier, isTailwind, testingFramework } = checkEnvironment();
2063
2027
  const configs = [];
2064
2028
  if (isGitIgnore) {
2065
- configs.push([(0, import_eslint_config_flat_gitignore.default)()]);
2029
+ configs.push([_eslintconfigflatgitignore2.default.call(void 0, )]);
2066
2030
  }
2067
2031
  configs.push(
2068
2032
  ignores(),
@@ -2089,3 +2053,8 @@ function factory() {
2089
2053
  const merged = configs.flat();
2090
2054
  return merged;
2091
2055
  }
2056
+
2057
+
2058
+ exports.default = factory;
2059
+
2060
+ module.exports = exports.default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@will-stone/eslint-config",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Will Stone's ESLint config",
5
5
  "keywords": [
6
6
  "eslint-config"
@@ -25,7 +25,7 @@
25
25
  "dist"
26
26
  ],
27
27
  "scripts": {
28
- "build": "tsup src/index.ts --format esm,cjs --clean --dts --cjsInterop",
28
+ "build": "tsup src/index.ts --format esm,cjs --clean --dts --cjsInterop --splitting",
29
29
  "dev": "tsup src/index.ts --format esm,cjs --watch & eslint-flat-config-viewer",
30
30
  "lint": "npm run stub && eslint .",
31
31
  "prepare": "husky install",