@mlaursen/eslint-config 5.1.2 → 5.2.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 +10 -0
- package/dist/base.d.ts +8 -0
- package/dist/base.js +11 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +3 -1
- package/dist/frontend.d.ts +22 -0
- package/dist/frontend.js +22 -0
- package/dist/gitignore.d.ts +16 -0
- package/dist/gitignore.js +16 -0
- package/dist/index.d.ts +22 -2
- package/dist/index.js +10 -5
- package/dist/jest.d.ts +16 -0
- package/dist/jest.js +18 -2
- package/dist/jsxA11y.d.ts +8 -0
- package/dist/jsxA11y.js +10 -4
- package/dist/next.d.ts +8 -0
- package/dist/next.js +10 -0
- package/dist/react.d.ts +7 -0
- package/dist/react.js +9 -2
- package/dist/testing-library.d.ts +23 -0
- package/dist/testing-library.js +25 -2
- package/dist/typescript.d.ts +10 -2
- package/dist/typescript.js +25 -11
- package/package.json +16 -17
package/README.md
CHANGED
|
@@ -22,6 +22,16 @@ export default config(gitignore(import.meta.url), ...configs.frontend);
|
|
|
22
22
|
|
|
23
23
|
// strict type checking
|
|
24
24
|
export default config(gitignore(import.meta.url), ...configs.frontendTypeChecking(import.meta.dirname));
|
|
25
|
+
|
|
26
|
+
// NOTE: This is recommended for strict type checking. Callable as:
|
|
27
|
+
// `cross-env STRICT_TYPING=true eslint "**/*.{ts,tsx,mts,mtsx,js,jsx,mjs,cjs}`
|
|
28
|
+
//
|
|
29
|
+
// strict type checking with an environment variable. uncomment the following
|
|
30
|
+
// line to enable it in your editor
|
|
31
|
+
// const strict = true || process.env.STRICT_TYPING === 'true';
|
|
32
|
+
const strict = process.env.STRICT_TYPING === 'true';
|
|
33
|
+
const frontend = strict ? configs.frontendTypeChecking(import.meta.dirname) : configs.frontend
|
|
34
|
+
export default (gitignore(import.meta.url), ...frontend);
|
|
25
35
|
```
|
|
26
36
|
|
|
27
37
|
The `config` export is the `typescript-eslint.config()` function to provide type
|
package/dist/base.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import { type TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* ```js
|
|
5
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
6
|
+
*
|
|
7
|
+
* export default configs.base;
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
2
10
|
export declare const base: TSESLint.FlatConfig.ConfigArray;
|
package/dist/base.js
CHANGED
|
@@ -6,10 +6,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.base = void 0;
|
|
7
7
|
var js_1 = __importDefault(require("@eslint/js"));
|
|
8
8
|
var constants_1 = require("./constants");
|
|
9
|
+
/**
|
|
10
|
+
* @example
|
|
11
|
+
* ```js
|
|
12
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
13
|
+
*
|
|
14
|
+
* export default configs.base;
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
9
17
|
exports.base = [
|
|
10
18
|
js_1.default.configs.recommended,
|
|
11
19
|
{
|
|
20
|
+
name: "".concat(constants_1.BASE_NAME, "/base"),
|
|
12
21
|
rules: {
|
|
22
|
+
// I use typescript instead
|
|
23
|
+
"no-undef": "off",
|
|
13
24
|
// You normally do not want `console.{whatever}` in prod but is fine for
|
|
14
25
|
// development in debugging
|
|
15
26
|
"no-console": constants_1.DEV_WARNING_PROD_ERROR,
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSX_FILES = exports.TEST_FILES = exports.DEV_WARNING_PROD_ERROR = void 0;
|
|
3
|
+
exports.JSX_FILES = exports.TEST_FILES = exports.TS_FILES = exports.BASE_NAME = exports.DEV_WARNING_PROD_ERROR = void 0;
|
|
4
4
|
exports.DEV_WARNING_PROD_ERROR = process.env.NODE_ENV !== "production" ? "warn" : "error";
|
|
5
|
+
exports.BASE_NAME = "@mlaursen/eslint-config";
|
|
6
|
+
exports.TS_FILES = ["**/*.{ts,tsx,mts,mtsx}"];
|
|
5
7
|
exports.TEST_FILES = [
|
|
6
8
|
"**/__tests__/**",
|
|
7
9
|
"**/*.{spec,test}.{ts,tsx,js,jsx}",
|
package/dist/frontend.d.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
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(
|
|
8
|
+
* gitignore(import.meta.url),
|
|
9
|
+
* ...configs.typescript
|
|
10
|
+
* );
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
2
13
|
export declare const frontend: TSESLint.FlatConfig.ConfigArray;
|
|
14
|
+
/**
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
18
|
+
*
|
|
19
|
+
* export default config(
|
|
20
|
+
* gitignore(import.meta.url),
|
|
21
|
+
* ...configs.typescriptTypeChecking(import.meta.dirname)
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
3
25
|
export declare const frontendTypeChecking: (tsconfigRootDir: string) => TSESLint.FlatConfig.ConfigArray;
|
package/dist/frontend.js
CHANGED
|
@@ -31,6 +31,28 @@ var jsxA11y_1 = require("./jsxA11y");
|
|
|
31
31
|
var react_1 = require("./react");
|
|
32
32
|
var testing_library_1 = require("./testing-library");
|
|
33
33
|
var typescript_1 = require("./typescript");
|
|
34
|
+
/**
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
38
|
+
*
|
|
39
|
+
* export default config(
|
|
40
|
+
* gitignore(import.meta.url),
|
|
41
|
+
* ...configs.typescript
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
34
45
|
exports.frontend = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(typescript_1.typescript), false), __read(react_1.react), false), __read(jsxA11y_1.jsxA11y), false), __read(jest_1.jest), false), __read(jest_1.jestDom), false), __read(testing_library_1.testingLibraryReact), false);
|
|
46
|
+
/**
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
50
|
+
*
|
|
51
|
+
* export default config(
|
|
52
|
+
* gitignore(import.meta.url),
|
|
53
|
+
* ...configs.typescriptTypeChecking(import.meta.dirname)
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
35
57
|
var frontendTypeChecking = function (tsconfigRootDir) { return __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, typescript_1.typescriptTypeChecking)(tsconfigRootDir)), false), __read(react_1.react), false), __read(jsxA11y_1.jsxA11y), false), __read(jest_1.jest), false), __read(jest_1.jestDom), false), __read(testing_library_1.testingLibraryReact), false); };
|
|
36
58
|
exports.frontendTypeChecking = frontendTypeChecking;
|
package/dist/gitignore.d.ts
CHANGED
|
@@ -1,2 +1,18 @@
|
|
|
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
|
+
*
|
|
10
|
+
* @example .gitignore in a different folder
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
13
|
+
* import { join } from "node:path";
|
|
14
|
+
*
|
|
15
|
+
* export default config(gitignore(join(import.meta.url, "..", "..")), ...configs.typescript);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
2
18
|
export declare function gitignore(importMetaUrl: string): TSESLint.FlatConfig.Config;
|
package/dist/gitignore.js
CHANGED
|
@@ -7,6 +7,22 @@ exports.gitignore = gitignore;
|
|
|
7
7
|
var compat_1 = require("@eslint/compat");
|
|
8
8
|
var node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
var node_url_1 = require("node:url");
|
|
10
|
+
/**
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
14
|
+
*
|
|
15
|
+
* export default config(gitignore(import.meta.url), ...configs.typescript);
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example .gitignore in a different folder
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
21
|
+
* import { join } from "node:path";
|
|
22
|
+
*
|
|
23
|
+
* export default config(gitignore(join(import.meta.url, "..", "..")), ...configs.typescript);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
10
26
|
function gitignore(importMetaUrl) {
|
|
11
27
|
var __filename = (0, node_url_1.fileURLToPath)(importMetaUrl);
|
|
12
28
|
var __dirname = node_path_1.default.dirname(__filename);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { config } from "typescript-eslint";
|
|
2
|
+
import { gitignore } from "./gitignore";
|
|
3
3
|
export declare const configs: {
|
|
4
4
|
readonly base: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
5
5
|
readonly jest: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
@@ -14,3 +14,23 @@ export declare const configs: {
|
|
|
14
14
|
readonly jsxA11y: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
15
15
|
readonly next: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
16
16
|
};
|
|
17
|
+
export { config, gitignore };
|
|
18
|
+
declare const _default: {
|
|
19
|
+
config: typeof config;
|
|
20
|
+
configs: {
|
|
21
|
+
readonly base: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
22
|
+
readonly jest: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
23
|
+
readonly jestDom: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
24
|
+
readonly react: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
25
|
+
readonly typescript: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
26
|
+
readonly typescriptTypeChecking: (tsconfigRootDir: string) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
27
|
+
readonly testingLibraryDom: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
28
|
+
readonly testingLibraryReact: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
29
|
+
readonly frontend: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
30
|
+
readonly frontendTypeChecking: (tsconfigRootDir: string) => import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
31
|
+
readonly jsxA11y: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
32
|
+
readonly next: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
33
|
+
};
|
|
34
|
+
gitignore: typeof gitignore;
|
|
35
|
+
};
|
|
36
|
+
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.gitignore = exports.config = exports.configs = void 0;
|
|
4
|
+
var typescript_eslint_1 = require("typescript-eslint");
|
|
5
|
+
Object.defineProperty(exports, "config", { enumerable: true, get: function () { return typescript_eslint_1.config; } });
|
|
4
6
|
var base_1 = require("./base");
|
|
5
7
|
var frontend_1 = require("./frontend");
|
|
8
|
+
var gitignore_1 = require("./gitignore");
|
|
9
|
+
Object.defineProperty(exports, "gitignore", { enumerable: true, get: function () { return gitignore_1.gitignore; } });
|
|
6
10
|
var jest_1 = require("./jest");
|
|
7
11
|
var jsxA11y_1 = require("./jsxA11y");
|
|
8
12
|
var next_1 = require("./next");
|
|
9
13
|
var react_1 = require("./react");
|
|
10
14
|
var testing_library_1 = require("./testing-library");
|
|
11
15
|
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
16
|
exports.configs = {
|
|
17
17
|
base: base_1.base,
|
|
18
18
|
jest: jest_1.jest,
|
|
@@ -27,3 +27,8 @@ exports.configs = {
|
|
|
27
27
|
jsxA11y: jsxA11y_1.jsxA11y,
|
|
28
28
|
next: next_1.next,
|
|
29
29
|
};
|
|
30
|
+
exports.default = {
|
|
31
|
+
config: typescript_eslint_1.config,
|
|
32
|
+
configs: exports.configs,
|
|
33
|
+
gitignore: gitignore_1.gitignore,
|
|
34
|
+
};
|
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
|
@@ -16,17 +16,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.jsxA11y = void 0;
|
|
18
18
|
var eslint_plugin_jsx_a11y_1 = __importDefault(require("eslint-plugin-jsx-a11y"));
|
|
19
|
-
var globals_1 = __importDefault(require("globals"));
|
|
20
19
|
var constants_1 = require("./constants");
|
|
20
|
+
/**
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { config, configs } from "@mlaursen/eslint-config";
|
|
24
|
+
*
|
|
25
|
+
* export default config(...configs.jsxA11y);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
21
28
|
exports.jsxA11y = [
|
|
22
|
-
__assign(__assign({ files: constants_1.JSX_FILES }, eslint_plugin_jsx_a11y_1.default.flatConfigs.recommended), {
|
|
23
|
-
globals: __assign({}, globals_1.default.browser),
|
|
24
|
-
}, rules: {
|
|
29
|
+
__assign(__assign({ name: "".concat(constants_1.BASE_NAME, "/jsx-a11y"), files: constants_1.JSX_FILES }, eslint_plugin_jsx_a11y_1.default.flatConfigs.recommended), { rules: {
|
|
25
30
|
// I **only** use autoFocus within dialogs which provide the correct
|
|
26
31
|
// context for screen readers.
|
|
27
32
|
"jsx-a11y/no-autofocus": "off",
|
|
28
33
|
} }),
|
|
29
34
|
{
|
|
35
|
+
name: "".concat(constants_1.BASE_NAME, "/jsx-a11y/testing"),
|
|
30
36
|
files: constants_1.TEST_FILES,
|
|
31
37
|
rules: {
|
|
32
38
|
"jsx-a11y/anchor-has-content": "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
|
@@ -17,13 +17,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.react = void 0;
|
|
18
18
|
var eslint_plugin_react_1 = __importDefault(require("eslint-plugin-react"));
|
|
19
19
|
var eslint_plugin_react_hooks_1 = __importDefault(require("eslint-plugin-react-hooks"));
|
|
20
|
-
var globals_1 = __importDefault(require("globals"));
|
|
21
20
|
var constants_1 = require("./constants");
|
|
21
|
+
// Why is the typedef optional?
|
|
22
22
|
var flat = eslint_plugin_react_1.default.configs.flat;
|
|
23
23
|
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: {
|
|
@@ -46,6 +54,5 @@ exports.react = [
|
|
|
46
54
|
additionalHooks: "(useIsomorphicLayoutEffect)",
|
|
47
55
|
},
|
|
48
56
|
] }),
|
|
49
|
-
languageOptions: __assign(__assign({}, flat.recommended.languageOptions), { globals: __assign({}, globals_1.default.browser) }),
|
|
50
57
|
},
|
|
51
58
|
];
|
|
@@ -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
|
*/
|
package/dist/testing-library.js
CHANGED
|
@@ -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
|
];
|
package/dist/typescript.d.ts
CHANGED
|
@@ -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;
|
package/dist/typescript.js
CHANGED
|
@@ -32,10 +32,22 @@ 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
|
-
|
|
45
|
+
name: "".concat(constants_1.BASE_NAME, "/typescript"),
|
|
46
|
+
files: constants_1.TS_FILES,
|
|
38
47
|
rules: {
|
|
48
|
+
// I normally do not want unified signatures since it helps improve type
|
|
49
|
+
// inference with function overloading
|
|
50
|
+
"@typescript-eslint/unified-signatures": "off",
|
|
39
51
|
// I prefer specifying when something is used only as a type
|
|
40
52
|
"@typescript-eslint/consistent-type-imports": [
|
|
41
53
|
"error",
|
|
@@ -71,6 +83,7 @@ exports.typescript = __spreadArray(__spreadArray(__spreadArray([], __read(base_1
|
|
|
71
83
|
},
|
|
72
84
|
},
|
|
73
85
|
{
|
|
86
|
+
name: "".concat(constants_1.BASE_NAME, "/typescript/tests"),
|
|
74
87
|
files: constants_1.TEST_FILES,
|
|
75
88
|
rules: {
|
|
76
89
|
// allow tests to be less strict
|
|
@@ -87,13 +100,21 @@ exports.typescript = __spreadArray(__spreadArray(__spreadArray([], __read(base_1
|
|
|
87
100
|
* @example
|
|
88
101
|
* ```ts
|
|
89
102
|
* // @ts-check
|
|
90
|
-
* import { config, configs } from "@mlaursen/eslint-config";
|
|
103
|
+
* import { config, configs, gitignore } from "@mlaursen/eslint-config";
|
|
91
104
|
*
|
|
92
|
-
* export default config(...configs.typescriptTypeChecking(import.meta.dirname));
|
|
105
|
+
* export default config(gitignore(import.meta.url), ...configs.typescriptTypeChecking(import.meta.dirname));
|
|
93
106
|
* ```
|
|
94
107
|
*/
|
|
95
108
|
var typescriptTypeChecking = function (tsconfigRootDir) { return __spreadArray(__spreadArray(__spreadArray([], __read(exports.typescript), false), __read(typescript_eslint_1.default.configs.strictTypeCheckedOnly), false), [
|
|
96
109
|
{
|
|
110
|
+
name: "".concat(constants_1.BASE_NAME, "/typescript-type-checking"),
|
|
111
|
+
files: constants_1.TS_FILES,
|
|
112
|
+
languageOptions: {
|
|
113
|
+
parserOptions: {
|
|
114
|
+
projectService: true,
|
|
115
|
+
tsconfigRootDir: tsconfigRootDir,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
97
118
|
rules: {
|
|
98
119
|
// I do not enable the `noUncheckedIndexedAccess` tsconfig option, so I
|
|
99
120
|
// still need to verify that stuff exists. There are other cases where I
|
|
@@ -117,6 +138,7 @@ var typescriptTypeChecking = function (tsconfigRootDir) { return __spreadArray(_
|
|
|
117
138
|
},
|
|
118
139
|
},
|
|
119
140
|
{
|
|
141
|
+
name: "".concat(constants_1.BASE_NAME, "/typescript-type-checking/tests"),
|
|
120
142
|
files: constants_1.TEST_FILES,
|
|
121
143
|
rules: {
|
|
122
144
|
// like base typescript, can be less strict in tests
|
|
@@ -125,13 +147,5 @@ var typescriptTypeChecking = function (tsconfigRootDir) { return __spreadArray(_
|
|
|
125
147
|
"@typescript-eslint/restrict-template-expressions": "off",
|
|
126
148
|
},
|
|
127
149
|
},
|
|
128
|
-
{
|
|
129
|
-
languageOptions: {
|
|
130
|
-
parserOptions: {
|
|
131
|
-
projectService: true,
|
|
132
|
-
tsconfigRootDir: tsconfigRootDir,
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
150
|
], false); };
|
|
137
151
|
exports.typescriptTypeChecking = typescriptTypeChecking;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mlaursen/eslint-config",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
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>",
|
|
@@ -20,32 +20,31 @@
|
|
|
20
20
|
"typescript"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@eslint/compat": "^1.2.
|
|
24
|
-
"@eslint/js": "^9.
|
|
23
|
+
"@eslint/compat": "^1.2.2",
|
|
24
|
+
"@eslint/js": "^9.14.0",
|
|
25
25
|
"@next/eslint-plugin-next": "^14.2.15",
|
|
26
26
|
"@types/eslint__js": "^8.42.3",
|
|
27
|
-
"@typescript-eslint/utils": "^8.
|
|
28
|
-
"eslint-plugin-jest": "^28.
|
|
27
|
+
"@typescript-eslint/utils": "^8.13.0",
|
|
28
|
+
"eslint-plugin-jest": "^28.9.0",
|
|
29
29
|
"eslint-plugin-jest-dom": "^5.4.0",
|
|
30
|
-
"eslint-plugin-jsx-a11y": "^6.10.
|
|
31
|
-
"eslint-plugin-react": "^7.37.
|
|
30
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
31
|
+
"eslint-plugin-react": "^7.37.2",
|
|
32
32
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
33
|
-
"eslint-plugin-testing-library": "^6.
|
|
34
|
-
"
|
|
35
|
-
"typescript-eslint": "^8.8.1"
|
|
33
|
+
"eslint-plugin-testing-library": "^6.4.0",
|
|
34
|
+
"typescript-eslint": "^8.13.0"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@changesets/cli": "^2.27.9",
|
|
39
|
-
"@inquirer/prompts": "^7.0.
|
|
38
|
+
"@inquirer/prompts": "^7.0.1",
|
|
40
39
|
"@octokit/core": "^6.1.2",
|
|
41
|
-
"@types/node": "^
|
|
40
|
+
"@types/node": "^22.9.0",
|
|
42
41
|
"dotenv": "^16.4.5",
|
|
43
|
-
"eslint": "^9.
|
|
42
|
+
"eslint": "^9.14.0",
|
|
44
43
|
"husky": "^9.1.6",
|
|
45
|
-
"inquirer": "^12.0.
|
|
44
|
+
"inquirer": "^12.0.1",
|
|
46
45
|
"lint-staged": "^15.2.10",
|
|
47
46
|
"prettier": "^3.3.3",
|
|
48
|
-
"tsx": "^4.19.
|
|
47
|
+
"tsx": "^4.19.2",
|
|
49
48
|
"typescript": "^5.6.3"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
@@ -69,8 +68,8 @@
|
|
|
69
68
|
]
|
|
70
69
|
},
|
|
71
70
|
"volta": {
|
|
72
|
-
"node": "
|
|
73
|
-
"pnpm": "9.12.
|
|
71
|
+
"node": "22.11.0",
|
|
72
|
+
"pnpm": "9.12.3"
|
|
74
73
|
},
|
|
75
74
|
"scripts": {
|
|
76
75
|
"clean": "rm -rf dist",
|