@open-xchange/linter-presets 0.5.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,148 +1,156 @@
1
1
  # Changelog
2
2
 
3
- ## [0.5.0] - 2024-08-15
3
+ ## `0.6.0` 2024-Aug-26
4
4
 
5
- - added: [ESLint] option `testingLib` for environment `env.vitest`
6
- - added: [ESLint] plugins `testing-library`, `jest-dom`, and option `testingLib` for environment `env.jest`
7
- - added: [ESLint] option `jestDom` for environments `env.jest` and `env.vitest`
5
+ - added: (ESLint) plugin `@eslint/markdown`
6
+
7
+ ## `0.5.1` 2024-Aug-22
8
+
9
+ - chore: bump dependencies
10
+
11
+ ## `0.5.0` – 2024-Aug-15
12
+
13
+ - added: (ESLint) option `testingLib` for environment `env.vitest`
14
+ - added: (ESLint) plugins `testing-library`, `jest-dom`, and option `testingLib` for environment `env.jest`
15
+ - added: (ESLint) option `jestDom` for environments `env.jest` and `env.vitest`
8
16
  - chore: bump dependencies
9
17
 
10
- ## [0.4.3] - 2024-08-08
18
+ ## `0.4.3` 2024-Aug-08
11
19
 
12
20
  - chore: bump dependencies
13
21
 
14
- ## [0.4.2] - 2024-08-06
22
+ ## `0.4.2` 2024-Aug-06
15
23
 
16
- - added: [ESLint] rules `jsdoc/check-template-names`, `jsdoc/require-asterisk-prefix`
24
+ - added: (ESLint) rules `jsdoc/check-template-names`, `jsdoc/require-asterisk-prefix`
17
25
 
18
- ## [0.4.1] - 2024-08-06
26
+ ## `0.4.1` 2024-Aug-06
19
27
 
20
- - added: [StyleLint] default ignore globs (`dist`)
28
+ - added: (StyleLint) default ignore globs (`dist`)
21
29
 
22
- ## [0.4.0] - 2024-08-06
30
+ ## `0.4.0` 2024-Aug-06
23
31
 
24
- - added: [ESLint] rules `jsdoc/require-template`, `jsdoc/require-throws`
25
- - changed: [StyleLint] default values of `stylistic` option (indent 4 spaces, double quotes)
32
+ - added: (ESLint) rules `jsdoc/require-template`, `jsdoc/require-throws`
33
+ - changed: (StyleLint) default values of `stylistic` option (indent 4 spaces, double quotes)
26
34
 
27
- ## [0.3.3] - 2024-08-01
35
+ ## `0.3.3` 2024-Aug-01
28
36
 
29
- - fixed: [ESLint] `env.tsconfig` must disable "projectService" explicitly
37
+ - fixed: (ESLint) `env.tsconfig` must disable "projectService" explicitly
30
38
 
31
- ## [0.3.2] - 2024-08-01
39
+ ## `0.3.2` 2024-Aug-01
32
40
 
33
- - added: [ESLint] restore environment `env.tsconfig` to workaround VSCode issues
41
+ - added: (ESLint) restore environment `env.tsconfig` to workaround VSCode issues
34
42
 
35
- ## [0.3.1] - 2024-08-01
43
+ ## `0.3.1` 2024-Aug-01
36
44
 
37
- - added: [ESLint] default ignore globs (`dist`, `gitlab-ci`, and others)
38
- - changed: [ESLint] default values of `stylistic` option (indent 4 spaces, always semicolons, double quotes)
45
+ - added: (ESLint) default ignore globs (`dist`, `gitlab-ci`, and others)
46
+ - changed: (ESLint) default values of `stylistic` option (indent 4 spaces, always semicolons, double quotes)
39
47
 
40
- ## [0.3.0] - 2024-08-01
48
+ ## `0.3.0` 2024-Aug-01
41
49
 
42
- - chore: [ESLint] [major bump of `typescript-eslint` to v8](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/)
43
- - removed: [ESLint] environment `env.tsconfig` (always using `projectService` of `typescript-eslint` instead)
44
- - changed: [ESLint] pattern for unused variables is now `^_.` (instead `^_`) to detect dangling underscore imports
50
+ - chore: (ESLint) [major bump of `typescript-eslint` to v8](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/)
51
+ - removed: (ESLint) environment `env.tsconfig` (always using `projectService` of `typescript-eslint` instead)
52
+ - changed: (ESLint) pattern for unused variables is now `^_.` (instead `^_`) to detect dangling underscore imports
45
53
 
46
- ## [0.2.0] - 2024-07-31
54
+ ## `0.2.0` 2024-Jul-31
47
55
 
48
56
  - chore: bump dependencies
49
57
  - chore: bump peer dependencies (eslint `^9.8` and stylelint `^16.8`)
50
58
 
51
- ## [0.1.13] - 2024-07-31
59
+ ## `0.1.13` 2024-Jul-31
52
60
 
53
61
  - change: disable rule `no-console` in environment `env.node`
54
62
  - chore: add renovate bot
55
63
  - chore: bump dependencies
56
64
 
57
- ## [0.1.12] - 2024-07-30
65
+ ## `0.1.12` 2024-Jul-30
58
66
 
59
67
  - chore: bump `eslint-plugin-jsdoc` dependency
60
68
 
61
- ## [0.1.11] - 2024-07-30
69
+ ## `0.1.11` 2024-Jul-30
62
70
 
63
71
  - chore: bump dependencies
64
72
  - skipped eslint-plugin-jsdoc: <https://github.com/gajus/eslint-plugin-jsdoc/issues/1282>
65
73
  - skipped @stylistic/eslint-plugin: <https://github.com/typescript-eslint/typescript-eslint/issues/9655>
66
74
 
67
- ## [0.1.10] - 2024-07-26
75
+ ## `0.1.10` 2024-Jul-26
68
76
 
69
77
  - chore: bump dependencies
70
78
  - chore: remove old license headers
71
79
 
72
- ## [0.1.9] - 2024-07-26
80
+ ## `0.1.9` 2024-Jul-26
73
81
 
74
- - added: [ESLint] `env.node`: option `settings` with shared settings for `eslint-plugin-n`
82
+ - added: (ESLint) `env.node`: option `settings` with shared settings for `eslint-plugin-n`
75
83
  - chore: bump dependencies
76
84
 
77
- ## [0.1.8] - 2024-07-23
85
+ ## `0.1.8` 2024-Jul-23
78
86
 
79
- - fixed: [ESLint] type error in rule `env-project/no-invalid-modules`
87
+ - fixed: (ESLint) type error in rule `env-project/no-invalid-modules`
80
88
 
81
- ## [0.1.7] - 2024-07-23
89
+ ## `0.1.7` 2024-Jul-23
82
90
 
83
- - changed: [ESLint] reverted option `modules` for `env.project` (introduced in 0.1.6)
84
- - changed: [ESLint] `env.project`: renamed option `packages` to `hierarchy`
85
- - chore: [ESLint] split rule `env-project/no-invalid-modules` (added `env-project/no-invalid-hierarchy`)
91
+ - changed: (ESLint) reverted option `modules` for `env.project` (introduced in 0.1.6)
92
+ - changed: (ESLint) `env.project`: renamed option `packages` to `hierarchy`
93
+ - chore: (ESLint) split rule `env-project/no-invalid-modules` (added `env-project/no-invalid-hierarchy`)
86
94
 
87
- ## [0.1.6] - 2024-07-23
95
+ ## `0.1.6` 2024-Jul-23
88
96
 
89
- - changed: [ESLint] moved rule options for `env.project` into own `modules` option
90
- - chore: [ESLint] unit test for `env.project`
97
+ - changed: (ESLint) moved rule options for `env.project` into own `modules` option
98
+ - chore: (ESLint) unit test for `env.project`
91
99
 
92
- ## [0.1.5] - 2024-07-23
100
+ ## `0.1.5` 2024-Jul-23
93
101
 
94
102
  - chore: bump dependencies
95
103
 
96
- ## [0.1.4] - 2024-07-15
104
+ ## `0.1.4` 2024-Jul-15
97
105
 
98
- - added: [ESLint] option `language.nativeDecorators` to support native ES decorators in JS files
106
+ - added: (ESLint) option `language.nativeDecorators` to support native ES decorators in JS files
99
107
 
100
- ## [0.1.3] - 2024-07-15
108
+ ## `0.1.3` 2024-Jul-15
101
109
 
102
110
  - chore: bump dependencies
103
111
 
104
- ## [0.1.2] - 2024-07-12
112
+ ## `0.1.2` 2024-Jul-12
105
113
 
106
- - added: [ESLint] option `restricted.nativeDecorators`
114
+ - added: (ESLint) option `restricted.nativeDecorators`
107
115
 
108
- ## [0.1.1] - 2024-07-11
116
+ ## `0.1.1` 2024-Jul-11
109
117
 
110
- - changed: [ESLint] option `stylistic.semi` as enum (always/never/off)
118
+ - changed: (ESLint) option `stylistic.semi` as enum (always/never/off)
111
119
 
112
- ## [0.1.0] - 2024-07-10
120
+ ## `0.1.0` 2024-Jul-10
113
121
 
114
122
  - chore: converted source code to TypeScript
115
123
 
116
- ## [0.0.6] - 2024-07-10
124
+ ## `0.0.6` 2024-Jul-10
117
125
 
118
- - fixed: [ESLint] type error in rule `env-project/no-invalid-modules`
126
+ - fixed: (ESLint) type error in rule `env-project/no-invalid-modules`
119
127
 
120
- ## [0.0.5] - 2024-07-10
128
+ ## `0.0.5` 2024-Jul-10
121
129
 
122
- - changed: [ESLint] `env-project/no-invalid-modules`: renamed option `packages.dependsOn` to `packages.extends`
123
- - chore: [ESLint] documentation for option `restricted`
130
+ - changed: (ESLint) `env-project/no-invalid-modules`: renamed option `packages.dependsOn` to `packages.extends`
131
+ - chore: (ESLint) documentation for option `restricted`
124
132
  - chore: bump dependencies
125
133
 
126
- ## [0.0.4] - 2024-07-10
134
+ ## `0.0.4` 2024-Jul-10
127
135
 
128
- - fixed: [ESLint] file exists detection in rule `env-project/no-invalid-modules`
136
+ - fixed: (ESLint) file exists detection in rule `env-project/no-invalid-modules`
129
137
 
130
- ## [0.0.3] - 2024-07-09
138
+ ## `0.0.3` 2024-Jul-09
131
139
 
132
- - added: [ESLint] `eslint-plugin-import`
133
- - added: [ESLint] option "restricted" for `env.node` and `env.browser`
134
- - added: [ESLint] custom rule `env-project/no-amd-module-directive`
135
- - added: [ESLint] custom rule `env-project/no-invalid-modules`
136
- - added: [ESLint] environment `env.project` (wraps all `env-project/*` rules)
137
- - changed: [ESLint] environment `env.plugin` renamed to `env.eslint`
138
- - fixed: [StyleLint] support for LESS files
140
+ - added: (ESLint) `eslint-plugin-import`
141
+ - added: (ESLint) option "restricted" for `env.node` and `env.browser`
142
+ - added: (ESLint) custom rule `env-project/no-amd-module-directive`
143
+ - added: (ESLint) custom rule `env-project/no-invalid-modules`
144
+ - added: (ESLint) environment `env.project` (wraps all `env-project/*` rules)
145
+ - changed: (ESLint) environment `env.plugin` renamed to `env.eslint`
146
+ - fixed: (StyleLint) support for LESS files
139
147
  - chore: bump dependencies
140
148
 
141
- ## [0.0.2] - 2024-07-08
149
+ ## `0.0.2` 2024-Jul-08
142
150
 
143
- - added: [StyleLint] project configuration (core, less, sass, license, stylistic)
151
+ - added: (StyleLint) project configuration (core, less, sass, license, stylistic)
144
152
 
145
- ## [0.0.1] - 2024-07-05
153
+ ## `0.0.1` 2024-Jul-05
146
154
 
147
- - added: [ESLint] project configuration (core, js, ts, json, yaml, license, directives, promises, jsdoc, stylistic)
148
- - added: [ESLint] environment presets (tsconfig, node, browser, jest, vitest, codecept, react, plugin)
155
+ - added: (ESLint) project configuration (core, js, ts, json, yaml, license, directives, promises, jsdoc, stylistic)
156
+ - added: (ESLint) environment presets (tsconfig, node, browser, jest, vitest, codecept, react, plugin)
@@ -1,5 +1,5 @@
1
1
  import type { TSESLint } from "@typescript-eslint/utils";
2
- import type { LanguageOptions } from "../shared/env-utils.js";
2
+ import { type LanguageOptions } from "../shared/env-utils.js";
3
3
  /**
4
4
  * Defines standard module settings and additional rules targeting JavaScript
5
5
  * _and_ TypeScript source files.
@@ -1,5 +1,6 @@
1
1
  import eslintJs from "@eslint/js";
2
2
  import babelParser from "@babel/eslint-parser";
3
+ import { JS_GLOB, SRC_GLOB, extGlob } from "../shared/env-utils.js";
3
4
  // functions ==================================================================
4
5
  /**
5
6
  * Defines standard module settings and additional rules targeting JavaScript
@@ -19,7 +20,7 @@ export default function base(options) {
19
20
  const languageOptions = (sourceType, ...extensions) => {
20
21
  const { ecmaVersion } = options;
21
22
  return {
22
- files: extensions.map(ext => "**/*." + ext),
23
+ files: extGlob(extensions),
23
24
  languageOptions: { ecmaVersion, sourceType },
24
25
  };
25
26
  };
@@ -39,7 +40,7 @@ export default function base(options) {
39
40
  languageOptions(options.sourceType, "js", "jsx", "ts", "tsx"),
40
41
  // ECMA decorators via Babel plugin
41
42
  ...(options.nativeDecorators ? [{
42
- files: ["**/*.{js,jsx,mjs,cjs}"],
43
+ files: JS_GLOB,
43
44
  languageOptions: {
44
45
  parser: babelParser,
45
46
  parserOptions: {
@@ -56,7 +57,7 @@ export default function base(options) {
56
57
  }] : []),
57
58
  // configure linter rules
58
59
  {
59
- files: ["**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}"],
60
+ files: SRC_GLOB,
60
61
  rules: {
61
62
  // enable all rules recommended by ESLint itself
62
63
  ...eslintJs.configs.recommended.rules,
@@ -1,4 +1,5 @@
1
1
  import commentsPluginConfigs from "@eslint-community/eslint-plugin-eslint-comments/configs";
2
+ import { SRC_GLOB } from "../shared/env-utils.js";
2
3
  // functions ==================================================================
3
4
  /**
4
5
  * Checks inline linter directives.
@@ -10,8 +11,9 @@ import commentsPluginConfigs from "@eslint-community/eslint-plugin-eslint-commen
10
11
  * An array of configuration objects to be added to the flat configuration.
11
12
  */
12
13
  export default function directives() {
13
- return [
14
- // register rule implementations and recommended rules
15
- commentsPluginConfigs.recommended,
16
- ];
14
+ // register rule implementations and recommended rules
15
+ return [{
16
+ files: SRC_GLOB,
17
+ ...commentsPluginConfigs.recommended,
18
+ }];
17
19
  }
@@ -1,4 +1,4 @@
1
- import { NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
1
+ import { JS_GLOB, NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
2
2
  // functions ==================================================================
3
3
  /**
4
4
  * Defines additional standard rules targeting JavaScript but _not_ TypeScript
@@ -9,7 +9,7 @@ import { NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
9
9
  */
10
10
  export default function js() {
11
11
  return [{
12
- files: ["**/*.{js,jsx,cjs,mjs}"],
12
+ files: JS_GLOB,
13
13
  rules: {
14
14
  // possible problems
15
15
  "no-duplicate-imports": "error",
@@ -1,4 +1,5 @@
1
1
  import jsdocPlugin from "eslint-plugin-jsdoc";
2
+ import { TS_GLOB, SRC_GLOB } from "../shared/env-utils.js";
2
3
  // functions ==================================================================
3
4
  /**
4
5
  * Checks the JSDoc comments in source files.
@@ -12,7 +13,10 @@ import jsdocPlugin from "eslint-plugin-jsdoc";
12
13
  export default function jsdoc() {
13
14
  return [
14
15
  // register rule implementations and recommended rules
15
- jsdocPlugin.configs["flat/recommended-error"],
16
+ {
17
+ files: SRC_GLOB,
18
+ ...jsdocPlugin.configs["flat/recommended-error"],
19
+ },
16
20
  // general configuration
17
21
  {
18
22
  settings: {
@@ -31,7 +35,7 @@ export default function jsdoc() {
31
35
  },
32
36
  // overrides for TypeScript files
33
37
  {
34
- files: ["**/*.{ts,tsx,cts,mts}"],
38
+ files: TS_GLOB,
35
39
  rules: {
36
40
  ...jsdocPlugin.configs["flat/recommended-typescript-error"].rules,
37
41
  "jsdoc/check-param-names": ["error", { allowExtraTrailingParamDocs: true }], // overload signatures
@@ -39,6 +43,7 @@ export default function jsdoc() {
39
43
  },
40
44
  // configure plugin rules
41
45
  {
46
+ files: SRC_GLOB,
42
47
  rules: {
43
48
  "jsdoc/check-template-names": "error",
44
49
  "jsdoc/require-asterisk-prefix": "error",
@@ -13,7 +13,7 @@ import jsonPlugin from "eslint-plugin-jsonc";
13
13
  * An array of configuration objects to be added to the flat configuration.
14
14
  */
15
15
  export default function json(options) {
16
- return [
16
+ const configs = [
17
17
  // register rule implementations and recommended rules
18
18
  ...jsonPlugin.configs["flat/recommended-with-json"],
19
19
  // reconfigure plugin rules
@@ -28,4 +28,7 @@ export default function json(options) {
28
28
  },
29
29
  },
30
30
  ];
31
+ // add missing "files" property in configurations with rules (otherwise, plugin conflicts with "@eslint/markdown")
32
+ const files = configs.find(config => config.files)?.files;
33
+ return configs.map(config => (!config.files && config.rules) ? { ...config, files } : config);
31
34
  }
@@ -1,4 +1,5 @@
1
1
  import licensePlugin from "eslint-plugin-license-header";
2
+ import { SRC_GLOB } from "../shared/env-utils.js";
2
3
  // functions ==================================================================
3
4
  /**
4
5
  * Checks the existence of license headers in source files.
@@ -14,7 +15,7 @@ import licensePlugin from "eslint-plugin-license-header";
14
15
  */
15
16
  export default function license(path) {
16
17
  return [{
17
- files: ["**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}"],
18
+ files: SRC_GLOB,
18
19
  // register rule implementations of the plugin
19
20
  plugins: {
20
21
  "license-header": licensePlugin,
@@ -0,0 +1,11 @@
1
+ import type { TSESLint } from "@typescript-eslint/utils";
2
+ /**
3
+ * Defines standard linting rules for Markdown files.
4
+ *
5
+ * Wraps the following packages:
6
+ * - `@eslint/markdown`
7
+ *
8
+ * @returns
9
+ * An array of configuration objects to be added to the flat configuration.
10
+ */
11
+ export default function markdown(): TSESLint.FlatConfig.ConfigArray;
@@ -0,0 +1,14 @@
1
+ import markdownPlugin from "@eslint/markdown";
2
+ // functions ==================================================================
3
+ /**
4
+ * Defines standard linting rules for Markdown files.
5
+ *
6
+ * Wraps the following packages:
7
+ * - `@eslint/markdown`
8
+ *
9
+ * @returns
10
+ * An array of configuration objects to be added to the flat configuration.
11
+ */
12
+ export default function markdown() {
13
+ return markdownPlugin.configs.recommended;
14
+ }
@@ -22,6 +22,8 @@ export default function stylistic(options) {
22
22
  stylisticPlugin.configs["disable-legacy"],
23
23
  // "@stylistic" plugin
24
24
  {
25
+ // do not lint markdown files
26
+ ignores: ["**/*.md"],
25
27
  // register rule implementations of the plugins
26
28
  plugins: {
27
29
  "@stylistic": stylisticPlugin,
@@ -1,5 +1,5 @@
1
1
  import typescriptEslint from "typescript-eslint";
2
- import { NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
2
+ import { TS_GLOB, DTS_GLOB, NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
3
3
  // functions ==================================================================
4
4
  /**
5
5
  * Defines standard rules for TypeScript source files.
@@ -13,7 +13,7 @@ import { NO_UNUSED_VARS_OPTIONS } from "../shared/env-utils.js";
13
13
  export default function ts() {
14
14
  // plugin configuration, additional rules
15
15
  return typescriptEslint.config({
16
- files: ["**/*.{ts,tsx,mts,cts}"],
16
+ files: TS_GLOB,
17
17
  // suppress warning for new TypeScript versions
18
18
  languageOptions: {
19
19
  parserOptions: {
@@ -68,7 +68,7 @@ export default function ts() {
68
68
  },
69
69
  // fixes for module definition files
70
70
  {
71
- files: ["**/*.d.{ts,tsx,mts,cts}"],
71
+ files: DTS_GLOB,
72
72
  rules: {
73
73
  "@typescript-eslint/consistent-type-exports": "off",
74
74
  "@typescript-eslint/consistent-type-imports": ["error", { prefer: "no-type-imports", disallowTypeAnnotations: false }],
@@ -13,7 +13,7 @@ import yamlPlugin from "eslint-plugin-yml";
13
13
  * An array of configuration objects to be added to the flat configuration.
14
14
  */
15
15
  export default function yaml(options) {
16
- return [
16
+ const configs = [
17
17
  // register rule implementations and recommended rules
18
18
  ...yamlPlugin.configs["flat/recommended"],
19
19
  // reconfigure plugin rules
@@ -25,4 +25,7 @@ export default function yaml(options) {
25
25
  },
26
26
  },
27
27
  ];
28
+ // add missing "files" property in configurations with rules (otherwise, plugin conflicts with "@eslint/markdown")
29
+ const files = configs.find(config => config.files)?.files;
30
+ return configs.map(config => (!config.files && config.rules) ? { ...config, files } : config);
28
31
  }
@@ -1,5 +1,5 @@
1
1
  import type { TSESLint } from "@typescript-eslint/utils";
2
- import type { EnvBaseOptions } from "../shared/env-utils.js";
2
+ import { type EnvBaseOptions } from "../shared/env-utils.js";
3
3
  /**
4
4
  * Configuration options for the environment preset "env.react".
5
5
  */
@@ -5,6 +5,7 @@ import reactRefreshPlugin from "eslint-plugin-react-refresh";
5
5
  import jsxExpressionsPlugin from "eslint-plugin-jsx-expressions";
6
6
  import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
7
7
  import { fixupPluginRules } from "@eslint/compat";
8
+ import { JS_GLOB } from "../shared/env-utils.js";
8
9
  import { concatConfigs, createConfig, customRules } from "../shared/env-utils.js";
9
10
  // functions ==================================================================
10
11
  /**
@@ -69,7 +70,7 @@ export default function react(envOptions) {
69
70
  }),
70
71
  // additional rules for TSX only
71
72
  createConfig(envOptions, {
72
- ignores: ["**/*.{js,jsx}"],
73
+ ignores: JS_GLOB,
73
74
  rules: {
74
75
  // replace "react/jsx-no-leaked-render" rule with advanced alternative
75
76
  "jsx-expressions/strict-logical-expressions": "error",
@@ -3,6 +3,7 @@ import js from "./config/js.js";
3
3
  import ts from "./config/ts.js";
4
4
  import json from "./config/json.js";
5
5
  import yaml from "./config/yaml.js";
6
+ import markdown from "./config/markdown.js";
6
7
  import license from "./config/license.js";
7
8
  import directives from "./config/directives.js";
8
9
  import imports from "./config/imports.js";
@@ -81,6 +82,8 @@ export function configure(options) {
81
82
  ...json(stylisticOptions),
82
83
  // default configuration for YAML files
83
84
  ...yaml(stylisticOptions),
85
+ // default configuration for Markdown files
86
+ ...markdown(),
84
87
  // check for correct license headers
85
88
  ...(options?.license ? license(options.license) : []),
86
89
  // default configuration for ESLint inline directives
@@ -84,6 +84,34 @@ export interface EnvBaseOptions extends EnvFilesOptions {
84
84
  */
85
85
  rules?: TSESLint.FlatConfig.Rules;
86
86
  }
87
+ /**
88
+ * File extensions for JavaScript source files.
89
+ */
90
+ export declare const JS_EXTENSIONS: string[];
91
+ /**
92
+ * File extensions for TypeScript source files.
93
+ */
94
+ export declare const TS_EXTENSIONS: string[];
95
+ /**
96
+ * File extensions for all source files (JavaScript and TypeScript).
97
+ */
98
+ export declare const SRC_EXTENSIONS: string[];
99
+ /**
100
+ * Glob array for JavaScript source files.
101
+ */
102
+ export declare const JS_GLOB: string[];
103
+ /**
104
+ * Glob array for TypeScript source files.
105
+ */
106
+ export declare const TS_GLOB: string[];
107
+ /**
108
+ * Glob array for TypeScript type declaration files.
109
+ */
110
+ export declare const DTS_GLOB: string[];
111
+ /**
112
+ * Glob array for all source files (JavaScript and TypeScript).
113
+ */
114
+ export declare const SRC_GLOB: string[];
87
115
  /**
88
116
  * Shared options for the core rule `no-unused-vars`, and the plugin rule
89
117
  * `@typescript-eslint/no-unused-vars`.
@@ -95,6 +123,17 @@ export declare const NO_UNUSED_VARS_OPTIONS: {
95
123
  caughtErrors: string;
96
124
  ignoreRestSiblings: boolean;
97
125
  };
126
+ /**
127
+ * Creates a glob pattern deeply matching all files with the specified file
128
+ * extensions.
129
+ *
130
+ * @param extensions
131
+ * The file extensions to be converted to a glob pattern.
132
+ *
133
+ * @returns
134
+ * The glob pattern for the specified file extensions.
135
+ */
136
+ export declare function extGlob(extensions: string[]): string[];
98
137
  /**
99
138
  * Concatenates and flattens multiple elements or arrays into a single array
100
139
  * while skipping all falsy parameters.
@@ -1,4 +1,32 @@
1
1
  // constants ==================================================================
2
+ /**
3
+ * File extensions for JavaScript source files.
4
+ */
5
+ export const JS_EXTENSIONS = ["js", "jsx", "mjs", "cjs"];
6
+ /**
7
+ * File extensions for TypeScript source files.
8
+ */
9
+ export const TS_EXTENSIONS = ["ts", "tsx", "mts", "cts"];
10
+ /**
11
+ * File extensions for all source files (JavaScript and TypeScript).
12
+ */
13
+ export const SRC_EXTENSIONS = [...JS_EXTENSIONS, ...TS_EXTENSIONS];
14
+ /**
15
+ * Glob array for JavaScript source files.
16
+ */
17
+ export const JS_GLOB = extGlob(JS_EXTENSIONS);
18
+ /**
19
+ * Glob array for TypeScript source files.
20
+ */
21
+ export const TS_GLOB = extGlob(TS_EXTENSIONS);
22
+ /**
23
+ * Glob array for TypeScript type declaration files.
24
+ */
25
+ export const DTS_GLOB = extGlob(TS_EXTENSIONS.map(ext => "d." + ext));
26
+ /**
27
+ * Glob array for all source files (JavaScript and TypeScript).
28
+ */
29
+ export const SRC_GLOB = extGlob(SRC_EXTENSIONS);
2
30
  /**
3
31
  * Shared options for the core rule `no-unused-vars`, and the plugin rule
4
32
  * `@typescript-eslint/no-unused-vars`.
@@ -11,6 +39,19 @@ export const NO_UNUSED_VARS_OPTIONS = {
11
39
  ignoreRestSiblings: true,
12
40
  };
13
41
  // functions ==================================================================
42
+ /**
43
+ * Creates a glob pattern deeply matching all files with the specified file
44
+ * extensions.
45
+ *
46
+ * @param extensions
47
+ * The file extensions to be converted to a glob pattern.
48
+ *
49
+ * @returns
50
+ * The glob pattern for the specified file extensions.
51
+ */
52
+ export function extGlob(extensions) {
53
+ return extensions.map(ext => "**/*." + ext);
54
+ }
14
55
  /**
15
56
  * Concatenates and flattens multiple elements or arrays into a single array
16
57
  * while skipping all falsy parameters.
@@ -6,8 +6,8 @@ import { type EnvBaseOptions } from "./env-utils.js";
6
6
  export interface EnvUnitTestOptions extends EnvBaseOptions {
7
7
  /**
8
8
  * Specifies whether to include `eslint-plugin-jest-dom`. Should only be
9
- * used, if the package `jest-dom` has been installed in the project.
10
- * Default value is `false`.
9
+ * used, if the package `@testing-library/jest-dom` has been installed in
10
+ * the project. Default value is `false`.
11
11
  */
12
12
  jestDom?: boolean;
13
13
  /**
@@ -15,6 +15,7 @@ Generates standard configuration targeting the source files in the entire projec
15
15
  | TypeScript files with type-aware rules (including `.tsx`) | [typescript-eslint](https://typescript-eslint.io/) |
16
16
  | JSON files | [eslint-plugin-jsonc](https://ota-meshi.github.io/eslint-plugin-jsonc/) |
17
17
  | YAML files | [eslint-plugin-yml](https://ota-meshi.github.io/eslint-plugin-yml/) |
18
+ | Markdown files | [@eslint/markdown](https://github.com/eslint/markdown) |
18
19
  | License headers | [eslint-plugin-license-header](https://github.com/nikku/eslint-plugin-license-header) |
19
20
  | ESLint inline directives | [@eslint-community/eslint-plugin-eslint-comments](https://github.com/eslint-community/eslint-plugin-eslint-comments) |
20
21
  | Module imports | [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/linter-presets",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Configuration presets for ESLint and StyleLint",
5
5
  "repository": {
6
6
  "url": "https://gitlab.open-xchange.com/fspd/npm-packages/linter-presets"
@@ -26,13 +26,14 @@
26
26
  "@babel/core": "7.25.2",
27
27
  "@babel/eslint-parser": "7.25.1",
28
28
  "@babel/plugin-proposal-decorators": "7.24.7",
29
- "@eslint-community/eslint-plugin-eslint-comments": "4.3.0",
29
+ "@eslint-community/eslint-plugin-eslint-comments": "4.4.0",
30
30
  "@eslint/compat": "1.1.1",
31
31
  "@eslint/js": "9.9.0",
32
+ "@eslint/markdown": "6.0.0",
32
33
  "@stylistic/eslint-plugin": "2.3.0",
33
34
  "@stylistic/eslint-plugin-migrate": "2.3.0",
34
35
  "@stylistic/stylelint-config": "2.0.0",
35
- "@stylistic/stylelint-plugin": "3.0.0",
36
+ "@stylistic/stylelint-plugin": "3.0.1",
36
37
  "confusing-browser-globals": "1.0.11",
37
38
  "eslint-plugin-chai-expect": "3.1.0",
38
39
  "eslint-plugin-codeceptjs": "1.3.0",
@@ -50,7 +51,7 @@
50
51
  "eslint-plugin-react": "7.35.0",
51
52
  "eslint-plugin-react-hooks": "4.6.2",
52
53
  "eslint-plugin-react-hooks-static-deps": "1.0.7",
53
- "eslint-plugin-react-refresh": "0.4.9",
54
+ "eslint-plugin-react-refresh": "0.4.10",
54
55
  "eslint-plugin-testing-library": "6.3.0",
55
56
  "eslint-plugin-vitest": "0.5.4",
56
57
  "eslint-plugin-yml": "1.14.0",
@@ -61,17 +62,18 @@
61
62
  "stylelint-config-standard-less": "3.0.1",
62
63
  "stylelint-config-standard-scss": "13.1.0",
63
64
  "stylelint-plugin-license-header": "1.0.3",
64
- "typescript-eslint": "8.1.0"
65
+ "typescript-eslint": "8.2.0"
65
66
  },
66
67
  "devDependencies": {
68
+ "@eslint/core": "0.4.0",
67
69
  "@types/confusing-browser-globals": "1.0.3",
68
70
  "@types/eslint__js": "8.42.3",
69
71
  "@types/picomatch": "3.0.1",
70
- "@typescript-eslint/utils": "8.1.0",
72
+ "@typescript-eslint/utils": "8.2.0",
71
73
  "eslint": "9.9.0",
72
- "husky": "9.1.4",
74
+ "husky": "9.1.5",
73
75
  "jest": "29.7.0",
74
- "stylelint": "16.8.1",
76
+ "stylelint": "16.8.2",
75
77
  "typescript": "5.5.4"
76
78
  },
77
79
  "peerDependencies": {