@zthun/janitor-eslint-config 21.2.4 → 21.2.5

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright (c) 2024 Anthony Bonta
3
+ Copyright (c) 2026 Anthony Bonta
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -6,23 +6,56 @@ This is the shared eslint configuration for zthun scoped projects.
6
6
 
7
7
  ```sh
8
8
  # NPM
9
- npm install @zthun/janitor-eslint-config --save-dev
9
+ npm install @zthun/janitor-eslint-config eslint --save-dev
10
+
10
11
  # Yarn
11
- yarn add @zthun/janitor-eslint-config --dev
12
+ yarn add @zthun/janitor-eslint-config eslint --dev
12
13
  ```
13
14
 
14
- Make sure to install typescript and @typescript-eslint/eslint-plugin with all
15
- peer dependencies.
16
-
17
15
  ## Usage
18
16
 
19
- In the .eslintrc file, add the following
17
+ This package is only for a flat config. The legacy config is no longer
18
+ supported.
19
+
20
+ The lint files are divided into multiple configurations for each project, but
21
+ for zthun scoped projects, you'll just use the recommended.
22
+
23
+ In your eslint.config.mjs file, add the following.
24
+
25
+ ```ts
26
+ import { environments, recommended } from "@zthun/janitor-eslint-config";
20
27
 
21
- ```json
22
- {
23
- "extends": ["@zthun/janitor-eslint-config"]
24
- }
28
+ export default [...recommended, ...environments.node];
25
29
  ```
26
30
 
27
31
  That's it. You now have the recommended rules for zthun scoped projects with
28
- typescript.
32
+ typescript. Note that using recommended also requires the prettier and
33
+ typescript node packages to be installed.
34
+
35
+ ## Available configs
36
+
37
+ | Config | For | Recommended |
38
+ | ------------------------------------------ | --------------------------------------------------------------------------------------------- | ----------- |
39
+ | [html](./lib/configs/html.mjs) | HTML linting | ✅ |
40
+ | [ignores](./lib/configs/ignores.mjs) | Standard global ignores for generated files and build outputs | ✅ |
41
+ | [javascript](./lib/configs/javascript.mjs) | JavaScript linting and import sorting | ✅ |
42
+ | [json](./lib/configs/json.mjs) | JSON, JSONC, and JSON5 linting | ✅ |
43
+ | [markdown](./lib/configs/markdown.mjs) | Markdown linting | ✅ |
44
+ | [prettier](./lib/configs/prettier.mjs) | Code formatting with Prettier. Requires [prettier](https://prettier.io/) | ✅ |
45
+ | [react](./lib/configs/react.mjs) | React linting. Requires [react](https://react.dev/) | |
46
+ | [spelling](./lib/configs/spelling.mjs) | Spell checking with a project dictionary | ✅ |
47
+ | [styles](./lib/configs/styles.mjs) | CSS linting | ✅ |
48
+ | [test](./lib/configs/test.mjs) | Vitest test linting | ✅ |
49
+ | [typescript](./lib/configs/typescript.mjs) | TypeScript linting with type checking. Requires [typescript](https://www.typescriptlang.org/) | ✅ |
50
+ | [yaml](./lib/configs/yaml.mjs) | YAML linting | ✅ |
51
+
52
+ ## Environments
53
+
54
+ You will probably need to add at least one environment to your eslint config.
55
+ There are two main environments. You can add plugins for various globals by
56
+ adding fields from the environment structure.
57
+
58
+ | Environment | For |
59
+ | ----------------------------------------- | ----------------------------------- |
60
+ | [browser](./lib/configs/environments.mjs) | Adds browser based globals |
61
+ | [node](./lib/configs/environments.mjs) | Adds node globals and node builtins |
@@ -11,7 +11,16 @@ function environment(environment) {
11
11
  });
12
12
  }
13
13
 
14
+ /**
15
+ * Configurations for different environments.
16
+ */
14
17
  export const environments = {
18
+ /**
19
+ * Adds support for browser globals.
20
+ */
15
21
  browser: [...environment(globals.browser)],
22
+ /**
23
+ * Adds support for node globals and node built in apis.
24
+ */
16
25
  node: [...environment(globals.node), ...environment(globals.nodeBuiltin)],
17
26
  };
@@ -4,6 +4,9 @@ import { defineConfig } from "eslint/config";
4
4
 
5
5
  import { ExtCss, ExtHtml, files } from "../files/files.mjs";
6
6
 
7
+ /**
8
+ * Adds html linting to your project.
9
+ */
7
10
  export const html = defineConfig([
8
11
  {
9
12
  ..._html.configs["flat/recommended"],
@@ -1,5 +1,8 @@
1
1
  import { defineConfig, globalIgnores } from "eslint/config";
2
2
 
3
+ /**
4
+ * Adds the standard global ignores.
5
+ */
3
6
  export const ignores = defineConfig([
4
7
  globalIgnores([
5
8
  // Outputs
@@ -6,6 +6,11 @@ import _unused from "eslint-plugin-unused-imports";
6
6
 
7
7
  import { ExtEs, files } from "../files/files.mjs";
8
8
 
9
+ /**
10
+ * Adds javascript linting to your project.
11
+ *
12
+ * You will most likely always need this one.
13
+ */
9
14
  export const javascript = defineConfig([
10
15
  {
11
16
  ...js.configs.recommended,
@@ -3,6 +3,9 @@ import { defineConfig } from "eslint/config";
3
3
 
4
4
  import { ExtJson, files } from "../files/files.mjs";
5
5
 
6
+ /**
7
+ * Adds json linting to your project.
8
+ */
6
9
  export const json = defineConfig([
7
10
  {
8
11
  ..._json.configs.recommended,
@@ -1,4 +1,7 @@
1
1
  import md from "@eslint/markdown";
2
2
  import { defineConfig } from "eslint/config";
3
3
 
4
+ /**
5
+ * Adds markdown linting to your project.
6
+ */
4
7
  export const markdown = defineConfig(...md.configs.recommended);
@@ -1,6 +1,13 @@
1
1
  import { defineConfig } from "eslint/config";
2
2
  import pretty from "eslint-plugin-prettier/recommended";
3
3
 
4
+ /**
5
+ * Adds stylistic code format linting to your project.
6
+ *
7
+ * If you have this as a plugin, then you should not use
8
+ * prettier as your default formatter, but instead just
9
+ * do an eslint fix on each save.
10
+ */
4
11
  export const prettier = defineConfig([
5
12
  pretty,
6
13
  {
@@ -3,6 +3,9 @@ import { defineConfig } from "eslint/config";
3
3
 
4
4
  import { ExtEs, files } from "../files/files.mjs";
5
5
 
6
+ /**
7
+ * Adds linting for react based projects.
8
+ */
6
9
  export const react = defineConfig([
7
10
  {
8
11
  files: files(...ExtEs),
@@ -12,6 +12,23 @@ import { test } from "./test.mjs";
12
12
  import { typescript } from "./typescript.mjs";
13
13
  import { yaml } from "./yaml.mjs";
14
14
 
15
+ /**
16
+ * A composite plugin list that adds all recommended plugins.
17
+ *
18
+ * This adds the following:
19
+ *
20
+ * 1. {@link ignores}
21
+ * 1. {@link javascript}
22
+ * 1. {@link typescript}
23
+ * 1. {@link markdown}
24
+ * 1. {@link json}
25
+ * 1. {@link yaml}
26
+ * 1. {@link styles}
27
+ * 1. {@link html}
28
+ * 1. {@link test}
29
+ * 1. {@link spelling}
30
+ * 1. {@link prettier}
31
+ */
15
32
  export const recommended = defineConfig([
16
33
  ...ignores,
17
34
  ...javascript,
@@ -1,4 +1,10 @@
1
1
  import cspell from "@cspell/eslint-plugin/recommended";
2
2
  import { defineConfig } from "eslint/config";
3
3
 
4
+ /**
5
+ * Adds linting for spelling.
6
+ *
7
+ * This assumes you have a cspell.json dictionary in your
8
+ * root or .config folder.
9
+ */
4
10
  export const spelling = defineConfig([cspell]);
@@ -3,6 +3,9 @@ import { defineConfig } from "eslint/config";
3
3
 
4
4
  import { ExtCss, files } from "../files/files.mjs";
5
5
 
6
+ /**
7
+ * Adds linting for css.
8
+ */
6
9
  export const styles = defineConfig([
7
10
  {
8
11
  ...css.configs.recommended,
@@ -3,6 +3,9 @@ import { defineConfig } from "eslint/config";
3
3
 
4
4
  import { ExtEs, filesTest } from "../files/files.mjs";
5
5
 
6
+ /**
7
+ * Adds linting for vitest.
8
+ */
6
9
  export const test = defineConfig([
7
10
  {
8
11
  ...vitest.configs.recommended,
@@ -14,6 +14,9 @@ const name = "typescript-eslint/recommended-type-checked";
14
14
  const recommended = recommendedTypeChecked.find((x) => x.name === name) || {};
15
15
  const { rules } = recommended;
16
16
 
17
+ /**
18
+ * Adds typescript linting to your project.
19
+ */
17
20
  export const typescript = defineConfig([
18
21
  {
19
22
  ...base,
@@ -1,4 +1,7 @@
1
1
  import { defineConfig } from "eslint/config";
2
2
  import { configs } from "eslint-plugin-yml";
3
3
 
4
+ /**
5
+ * Adds support to lint yaml files.
6
+ */
4
7
  export const yaml = defineConfig([configs.recommended]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zthun/janitor-eslint-config",
3
- "version": "21.2.4",
3
+ "version": "21.2.5",
4
4
  "description": "A shared configuration for eslint for @zthun scoped projects.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -24,28 +24,27 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@cspell/eslint-plugin": "^10.3.6",
27
- "@eslint-react/eslint-plugin": "^5.23.3",
27
+ "@eslint-react/eslint-plugin": "^5.26.5",
28
28
  "@eslint/css": "^2.0.0",
29
29
  "@eslint/js": "^10.0.1",
30
- "@eslint/json": "^2.1.0",
30
+ "@eslint/json": "^2.1.1",
31
31
  "@eslint/markdown": "^8.0.3",
32
32
  "@html-eslint/eslint-plugin": "^0.66.1",
33
33
  "@vitest/eslint-plugin": "^1.6.27",
34
34
  "eslint-config-prettier": "^10.1.8",
35
35
  "eslint-plugin-import-x": "^4.17.1",
36
- "eslint-plugin-prettier": "^5.5.6",
36
+ "eslint-plugin-prettier": "^5.5.7",
37
37
  "eslint-plugin-simple-import-sort": "^14.0.0",
38
38
  "eslint-plugin-unused-imports": "^4.4.1",
39
- "eslint-plugin-yml": "^3.8.1",
40
- "globals": "^17.12.0",
41
- "typescript-eslint": "^8.71.0"
39
+ "eslint-plugin-yml": "^3.9.0",
40
+ "globals": "^17.13.0",
41
+ "typescript-eslint": "^8.71.2"
42
42
  },
43
43
  "devDependencies": {
44
- "@zthun/janitor-build-config": "^21.2.4",
45
- "eslint": "^10.11.0",
46
- "prettier": "^3.9.9",
44
+ "eslint": "^10.12.0",
45
+ "prettier": "^3.9.10",
47
46
  "typescript": "^6.0.3",
48
- "vite": "^8.3.1"
47
+ "vite": "^8.3.4"
49
48
  },
50
49
  "peerDependencies": {
51
50
  "eslint": "^10",
@@ -54,13 +53,19 @@
54
53
  "typescript": ">=5 <7"
55
54
  },
56
55
  "peerDependenciesMeta": {
56
+ "prettier": {
57
+ "optional": true
58
+ },
57
59
  "react": {
58
60
  "optional": true
61
+ },
62
+ "typescript": {
63
+ "optional": true
59
64
  }
60
65
  },
61
66
  "publishConfig": {
62
67
  "access": "public"
63
68
  },
64
69
  "author": "Anthony Bonta",
65
- "gitHead": "1202551e1e0ddb0faa154a92ddfa2ee4fe5c2268"
70
+ "gitHead": "f390a3b8968c3d156a9f5ed4b6227ef0d9d963e2"
66
71
  }