@mlaursen/eslint-config 5.1.2 → 5.1.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.
package/dist/index.js CHANGED
@@ -1,18 +1,23 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configs = exports.gitignore = exports.config = void 0;
6
+ exports.globals = exports.gitignore = exports.config = exports.configs = void 0;
7
+ var globals_1 = __importDefault(require("globals"));
8
+ exports.globals = globals_1.default;
9
+ var typescript_eslint_1 = require("typescript-eslint");
10
+ Object.defineProperty(exports, "config", { enumerable: true, get: function () { return typescript_eslint_1.config; } });
4
11
  var base_1 = require("./base");
5
12
  var frontend_1 = require("./frontend");
13
+ var gitignore_1 = require("./gitignore");
14
+ Object.defineProperty(exports, "gitignore", { enumerable: true, get: function () { return gitignore_1.gitignore; } });
6
15
  var jest_1 = require("./jest");
7
16
  var jsxA11y_1 = require("./jsxA11y");
8
17
  var next_1 = require("./next");
9
18
  var react_1 = require("./react");
10
19
  var testing_library_1 = require("./testing-library");
11
20
  var typescript_1 = require("./typescript");
12
- var typescript_eslint_1 = require("typescript-eslint");
13
- Object.defineProperty(exports, "config", { enumerable: true, get: function () { return typescript_eslint_1.config; } });
14
- var gitignore_1 = require("./gitignore");
15
- Object.defineProperty(exports, "gitignore", { enumerable: true, get: function () { return gitignore_1.gitignore; } });
16
21
  exports.configs = {
17
22
  base: base_1.base,
18
23
  jest: jest_1.jest,
@@ -27,3 +32,9 @@ exports.configs = {
27
32
  jsxA11y: jsxA11y_1.jsxA11y,
28
33
  next: next_1.next,
29
34
  };
35
+ exports.default = {
36
+ config: typescript_eslint_1.config,
37
+ configs: exports.configs,
38
+ globals: globals_1.default,
39
+ gitignore: gitignore_1.gitignore,
40
+ };
package/dist/jest.d.ts CHANGED
@@ -1,3 +1,19 @@
1
1
  import { type TSESLint } from "@typescript-eslint/utils";
2
+ /**
3
+ * @example
4
+ * ```ts
5
+ * import { config, configs } from "@mlaursen/eslint-config";
6
+ *
7
+ * export default config(...configs.jest);
8
+ * ```
9
+ */
2
10
  export declare const jest: TSESLint.FlatConfig.ConfigArray;
11
+ /**
12
+ * @example
13
+ * ```ts
14
+ * import { config, configs } from "@mlaursen/eslint-config";
15
+ *
16
+ * export default config(...configs.jest, ...configs.jestDom);
17
+ * ```
18
+ */
3
19
  export declare const jestDom: TSESLint.FlatConfig.ConfigArray;
package/dist/jest.js CHANGED
@@ -18,9 +18,25 @@ exports.jestDom = exports.jest = void 0;
18
18
  var eslint_plugin_jest_1 = __importDefault(require("eslint-plugin-jest"));
19
19
  var eslint_plugin_jest_dom_1 = __importDefault(require("eslint-plugin-jest-dom"));
20
20
  var constants_1 = require("./constants");
21
+ /**
22
+ * @example
23
+ * ```ts
24
+ * import { config, configs } from "@mlaursen/eslint-config";
25
+ *
26
+ * export default config(...configs.jest);
27
+ * ```
28
+ */
21
29
  exports.jest = [
22
- __assign({ files: constants_1.TEST_FILES }, eslint_plugin_jest_1.default.configs["flat/recommended"]),
30
+ __assign({ name: "".concat(constants_1.BASE_NAME, "/jest"), files: constants_1.TEST_FILES }, eslint_plugin_jest_1.default.configs["flat/recommended"]),
23
31
  ];
32
+ /**
33
+ * @example
34
+ * ```ts
35
+ * import { config, configs } from "@mlaursen/eslint-config";
36
+ *
37
+ * export default config(...configs.jest, ...configs.jestDom);
38
+ * ```
39
+ */
24
40
  exports.jestDom = [
25
- __assign({ files: constants_1.TEST_FILES }, eslint_plugin_jest_dom_1.default.configs["flat/recommended"]),
41
+ __assign({ name: "".concat(constants_1.BASE_NAME, "/jest-dom"), files: constants_1.TEST_FILES }, eslint_plugin_jest_dom_1.default.configs["flat/recommended"]),
26
42
  ];
package/dist/jsxA11y.d.ts CHANGED
@@ -1,2 +1,10 @@
1
1
  import { type TSESLint } from "@typescript-eslint/utils";
2
+ /**
3
+ * @example
4
+ * ```ts
5
+ * import { config, configs } from "@mlaursen/eslint-config";
6
+ *
7
+ * export default config(...configs.jsxA11y);
8
+ * ```
9
+ */
2
10
  export declare const jsxA11y: TSESLint.FlatConfig.ConfigArray;
package/dist/jsxA11y.js CHANGED
@@ -18,8 +18,16 @@ exports.jsxA11y = void 0;
18
18
  var eslint_plugin_jsx_a11y_1 = __importDefault(require("eslint-plugin-jsx-a11y"));
19
19
  var globals_1 = __importDefault(require("globals"));
20
20
  var constants_1 = require("./constants");
21
+ /**
22
+ * @example
23
+ * ```ts
24
+ * import { config, configs } from "@mlaursen/eslint-config";
25
+ *
26
+ * export default config(...configs.jsxA11y);
27
+ * ```
28
+ */
21
29
  exports.jsxA11y = [
22
- __assign(__assign({ files: constants_1.JSX_FILES }, eslint_plugin_jsx_a11y_1.default.flatConfigs.recommended), { languageOptions: {
30
+ __assign(__assign({ name: "".concat(constants_1.BASE_NAME, "/jsx-a11y"), files: constants_1.JSX_FILES }, eslint_plugin_jsx_a11y_1.default.flatConfigs.recommended), { languageOptions: {
23
31
  globals: __assign({}, globals_1.default.browser),
24
32
  }, rules: {
25
33
  // I **only** use autoFocus within dialogs which provide the correct
@@ -28,6 +36,7 @@ exports.jsxA11y = [
28
36
  } }),
29
37
  {
30
38
  files: constants_1.TEST_FILES,
39
+ name: "".concat(constants_1.BASE_NAME, "/jsx-a11y/testing"),
31
40
  rules: {
32
41
  "jsx-a11y/anchor-has-content": "off",
33
42
  "jsx-a11y/click-events-have-key-events": "off",
package/dist/next.d.ts CHANGED
@@ -1,2 +1,10 @@
1
1
  import { type TSESLint } from "@typescript-eslint/utils";
2
+ /**
3
+ * @example
4
+ * ```ts
5
+ * import { config, configs, gitignore } from "@mlaursen/eslint-config";
6
+ *
7
+ * export default config(gitignore(import.meta.url), ...configs.typescript, ...configs.next);
8
+ * ```
9
+ */
2
10
  export declare const next: TSESLint.FlatConfig.ConfigArray;
package/dist/next.js CHANGED
@@ -17,8 +17,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.next = void 0;
18
18
  var compat_1 = require("@eslint/compat");
19
19
  var eslint_plugin_next_1 = __importDefault(require("@next/eslint-plugin-next"));
20
+ var constants_1 = require("./constants");
21
+ /**
22
+ * @example
23
+ * ```ts
24
+ * import { config, configs, gitignore } from "@mlaursen/eslint-config";
25
+ *
26
+ * export default config(gitignore(import.meta.url), ...configs.typescript, ...configs.next);
27
+ * ```
28
+ */
20
29
  exports.next = [
21
30
  {
31
+ name: "".concat(constants_1.BASE_NAME, "/next"),
22
32
  plugins: {
23
33
  // @ts-expect-error There is a bad typing atm
24
34
  "@next/next": (0, compat_1.fixupPluginRules)(eslint_plugin_next_1.default),
package/dist/react.d.ts CHANGED
@@ -1,5 +1,12 @@
1
1
  import { type TSESLint } from "@typescript-eslint/utils";
2
2
  /**
3
+ * @example
4
+ * ```ts
5
+ * import { config, configs } from "@mlaursen/eslint-config";
6
+ *
7
+ * export default config(...configs.react);
8
+ * ```
9
+ *
3
10
  * Enables:
4
11
  * - `eslint-plugin-react` with:
5
12
  * - flat.recommended
package/dist/react.js CHANGED
@@ -24,6 +24,13 @@ var reactPlugins = flat.recommended.plugins;
24
24
  var recommendedRules = flat.recommended.rules;
25
25
  var jsxRuntimeRules = flat["jsx-runtime"].rules;
26
26
  /**
27
+ * @example
28
+ * ```ts
29
+ * import { config, configs } from "@mlaursen/eslint-config";
30
+ *
31
+ * export default config(...configs.react);
32
+ * ```
33
+ *
27
34
  * Enables:
28
35
  * - `eslint-plugin-react` with:
29
36
  * - flat.recommended
@@ -33,6 +40,7 @@ var jsxRuntimeRules = flat["jsx-runtime"].rules;
33
40
  */
34
41
  exports.react = [
35
42
  {
43
+ name: "".concat(constants_1.BASE_NAME, "/react"),
36
44
  files: constants_1.JSX_FILES,
37
45
  settings: {
38
46
  react: {
@@ -1,10 +1,33 @@
1
1
  import { type TSESLint } from "@typescript-eslint/utils";
2
2
  /**
3
+ * @example
4
+ * ```ts
5
+ * import { config, configs } from "@mlaursen/eslint-config";
6
+ *
7
+ * export default config(
8
+ * ...configs.react,
9
+ * ...configs.jest,
10
+ * ...configs.jestDom,
11
+ * ...configs.testingLibraryReact
12
+ * );
13
+ * ```
14
+ *
3
15
  * NOTE: Only choose this or the {@link testingLibraryDom}. Do not use
4
16
  * both.
5
17
  */
6
18
  export declare const testingLibraryReact: TSESLint.FlatConfig.ConfigArray;
7
19
  /**
20
+ * @example
21
+ * ```ts
22
+ * import { config, configs } from "@mlaursen/eslint-config";
23
+ *
24
+ * export default config(
25
+ * ...configs.jest,
26
+ * ...configs.jestDom,
27
+ * ...configs.testingLibraryDom
28
+ * );
29
+ * ```
30
+ *
8
31
  * NOTE: Only choose this or the {@link testingLibraryReact}. Do not use
9
32
  * both.
10
33
  */
@@ -26,16 +26,39 @@ var testingLibrary = {
26
26
  },
27
27
  };
28
28
  /**
29
+ * @example
30
+ * ```ts
31
+ * import { config, configs } from "@mlaursen/eslint-config";
32
+ *
33
+ * export default config(
34
+ * ...configs.react,
35
+ * ...configs.jest,
36
+ * ...configs.jestDom,
37
+ * ...configs.testingLibraryReact
38
+ * );
39
+ * ```
40
+ *
29
41
  * NOTE: Only choose this or the {@link testingLibraryDom}. Do not use
30
42
  * both.
31
43
  */
32
44
  exports.testingLibraryReact = [
33
- __assign(__assign({}, testingLibrary), { rules: __assign({}, eslint_plugin_testing_library_1.default.configs["flat/react"].rules) }),
45
+ __assign(__assign({}, testingLibrary), { name: "".concat(constants_1.BASE_NAME, "/testing-library/react"), rules: __assign({}, eslint_plugin_testing_library_1.default.configs["flat/react"].rules) }),
34
46
  ];
35
47
  /**
48
+ * @example
49
+ * ```ts
50
+ * import { config, configs } from "@mlaursen/eslint-config";
51
+ *
52
+ * export default config(
53
+ * ...configs.jest,
54
+ * ...configs.jestDom,
55
+ * ...configs.testingLibraryDom
56
+ * );
57
+ * ```
58
+ *
36
59
  * NOTE: Only choose this or the {@link testingLibraryReact}. Do not use
37
60
  * both.
38
61
  */
39
62
  exports.testingLibraryDom = [
40
- __assign(__assign({}, testingLibrary), { rules: __assign({}, eslint_plugin_testing_library_1.default.configs["flat/dom"].rules) }),
63
+ __assign(__assign({}, testingLibrary), { name: "".concat(constants_1.BASE_NAME, "/testing-library/dom"), rules: __assign({}, eslint_plugin_testing_library_1.default.configs["flat/dom"].rules) }),
41
64
  ];
@@ -1,12 +1,20 @@
1
1
  import { type TSESLint } from "@typescript-eslint/utils";
2
+ /**
3
+ * @example
4
+ * ```ts
5
+ * import { config, configs, gitignore } from "@mlaursen/eslint-config";
6
+ *
7
+ * export default config(gitignore(import.meta.url), ...configs.typescript);
8
+ * ```
9
+ */
2
10
  export declare const typescript: TSESLint.FlatConfig.ConfigArray;
3
11
  /**
4
12
  * @example
5
13
  * ```ts
6
14
  * // @ts-check
7
- * import { config, configs } from "@mlaursen/eslint-config";
15
+ * import { config, configs, gitignore } from "@mlaursen/eslint-config";
8
16
  *
9
- * export default config(...configs.typescriptTypeChecking(import.meta.dirname));
17
+ * export default config(gitignore(import.meta.url), ...configs.typescriptTypeChecking(import.meta.dirname));
10
18
  * ```
11
19
  */
12
20
  export declare const typescriptTypeChecking: (tsconfigRootDir: string) => TSESLint.FlatConfig.ConfigArray;
@@ -32,9 +32,18 @@ exports.typescriptTypeChecking = exports.typescript = void 0;
32
32
  var typescript_eslint_1 = __importDefault(require("typescript-eslint"));
33
33
  var base_1 = require("./base");
34
34
  var constants_1 = require("./constants");
35
+ /**
36
+ * @example
37
+ * ```ts
38
+ * import { config, configs, gitignore } from "@mlaursen/eslint-config";
39
+ *
40
+ * export default config(gitignore(import.meta.url), ...configs.typescript);
41
+ * ```
42
+ */
35
43
  exports.typescript = __spreadArray(__spreadArray(__spreadArray([], __read(base_1.base), false), __read(typescript_eslint_1.default.configs.strict), false), [
36
44
  {
37
- files: ["**/*.{ts,tsx}"],
45
+ name: "".concat(constants_1.BASE_NAME, "/typescript"),
46
+ files: constants_1.TS_FILES,
38
47
  rules: {
39
48
  // I prefer specifying when something is used only as a type
40
49
  "@typescript-eslint/consistent-type-imports": [
@@ -71,6 +80,7 @@ exports.typescript = __spreadArray(__spreadArray(__spreadArray([], __read(base_1
71
80
  },
72
81
  },
73
82
  {
83
+ name: "".concat(constants_1.BASE_NAME, "/typescript/tests"),
74
84
  files: constants_1.TEST_FILES,
75
85
  rules: {
76
86
  // allow tests to be less strict
@@ -87,13 +97,21 @@ exports.typescript = __spreadArray(__spreadArray(__spreadArray([], __read(base_1
87
97
  * @example
88
98
  * ```ts
89
99
  * // @ts-check
90
- * import { config, configs } from "@mlaursen/eslint-config";
100
+ * import { config, configs, gitignore } from "@mlaursen/eslint-config";
91
101
  *
92
- * export default config(...configs.typescriptTypeChecking(import.meta.dirname));
102
+ * export default config(gitignore(import.meta.url), ...configs.typescriptTypeChecking(import.meta.dirname));
93
103
  * ```
94
104
  */
95
105
  var typescriptTypeChecking = function (tsconfigRootDir) { return __spreadArray(__spreadArray(__spreadArray([], __read(exports.typescript), false), __read(typescript_eslint_1.default.configs.strictTypeCheckedOnly), false), [
96
106
  {
107
+ name: "".concat(constants_1.BASE_NAME, "/typescript-type-checking"),
108
+ files: constants_1.TS_FILES,
109
+ languageOptions: {
110
+ parserOptions: {
111
+ projectService: true,
112
+ tsconfigRootDir: tsconfigRootDir,
113
+ },
114
+ },
97
115
  rules: {
98
116
  // I do not enable the `noUncheckedIndexedAccess` tsconfig option, so I
99
117
  // still need to verify that stuff exists. There are other cases where I
@@ -117,6 +135,7 @@ var typescriptTypeChecking = function (tsconfigRootDir) { return __spreadArray(_
117
135
  },
118
136
  },
119
137
  {
138
+ name: "".concat(constants_1.BASE_NAME, "/typescript-type-checking/tests"),
120
139
  files: constants_1.TEST_FILES,
121
140
  rules: {
122
141
  // like base typescript, can be less strict in tests
@@ -125,13 +144,5 @@ var typescriptTypeChecking = function (tsconfigRootDir) { return __spreadArray(_
125
144
  "@typescript-eslint/restrict-template-expressions": "off",
126
145
  },
127
146
  },
128
- {
129
- languageOptions: {
130
- parserOptions: {
131
- projectService: true,
132
- tsconfigRootDir: tsconfigRootDir,
133
- },
134
- },
135
- },
136
147
  ], false); };
137
148
  exports.typescriptTypeChecking = typescriptTypeChecking;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlaursen/eslint-config",
3
- "version": "5.1.2",
3
+ "version": "5.1.3",
4
4
  "description": "An eslint config used by mlaursen for most projects.",
5
5
  "repository": "https://github.com/mlaursen/eslint-config.git",
6
6
  "author": "Mikkel Laursen <mlaursen03@gmail.com>",