@open-xchange/linter-presets 1.6.0 → 1.7.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/eslint/core/base.d.ts +3 -4
  3. package/dist/eslint/core/base.js +95 -94
  4. package/dist/eslint/core/directives.d.ts +3 -3
  5. package/dist/eslint/core/directives.js +4 -4
  6. package/dist/eslint/core/js.d.ts +3 -3
  7. package/dist/eslint/core/js.js +4 -4
  8. package/dist/eslint/core/jsdoc.d.ts +3 -3
  9. package/dist/eslint/core/jsdoc.js +43 -42
  10. package/dist/eslint/core/json.d.ts +3 -4
  11. package/dist/eslint/core/json.js +4 -4
  12. package/dist/eslint/core/license.d.ts +4 -4
  13. package/dist/eslint/core/license.js +5 -5
  14. package/dist/eslint/core/markdown.d.ts +1 -1
  15. package/dist/eslint/core/markdown.js +1 -1
  16. package/dist/eslint/core/packages.d.ts +3 -4
  17. package/dist/eslint/core/packages.js +16 -15
  18. package/dist/eslint/core/promises.d.ts +3 -3
  19. package/dist/eslint/core/promises.js +18 -18
  20. package/dist/eslint/core/regexp.d.ts +3 -3
  21. package/dist/eslint/core/regexp.js +4 -5
  22. package/dist/eslint/core/stylistic.d.ts +3 -4
  23. package/dist/eslint/core/stylistic.js +99 -99
  24. package/dist/eslint/core/ts.d.ts +6 -3
  25. package/dist/eslint/core/ts.js +78 -72
  26. package/dist/eslint/core/vue.d.ts +3 -4
  27. package/dist/eslint/core/vue.js +4 -4
  28. package/dist/eslint/core/yaml.d.ts +3 -4
  29. package/dist/eslint/core/yaml.js +4 -4
  30. package/dist/eslint/env/browser.d.ts +3 -3
  31. package/dist/eslint/env/browser.js +18 -17
  32. package/dist/eslint/env/codecept.d.ts +3 -4
  33. package/dist/eslint/env/codecept.js +27 -26
  34. package/dist/eslint/env/decorators.d.ts +3 -4
  35. package/dist/eslint/env/decorators.js +19 -16
  36. package/dist/eslint/env/eslint.d.ts +3 -4
  37. package/dist/eslint/env/eslint.js +16 -15
  38. package/dist/eslint/env/jest.d.ts +3 -3
  39. package/dist/eslint/env/jest.js +37 -36
  40. package/dist/eslint/env/node.d.ts +3 -4
  41. package/dist/eslint/env/node.js +22 -21
  42. package/dist/eslint/env/project.d.ts +3 -4
  43. package/dist/eslint/env/project.js +25 -24
  44. package/dist/eslint/env/react.d.ts +3 -4
  45. package/dist/eslint/env/react.js +65 -64
  46. package/dist/eslint/env/tsconfig.d.ts +3 -4
  47. package/dist/eslint/env/tsconfig.js +14 -13
  48. package/dist/eslint/env/vitest.d.ts +3 -3
  49. package/dist/eslint/env/vitest.js +54 -53
  50. package/dist/eslint/index.d.ts +26 -21
  51. package/dist/eslint/index.js +15 -13
  52. package/dist/eslint/shared/env-utils.d.ts +11 -23
  53. package/dist/eslint/shared/env-utils.js +17 -31
  54. package/dist/eslint/shared/restricted.d.ts +3 -3
  55. package/dist/eslint/shared/restricted.js +12 -11
  56. package/dist/eslint/shared/unittest.d.ts +4 -5
  57. package/dist/eslint/shared/unittest.js +21 -20
  58. package/dist/stylelint/index.d.ts +9 -6
  59. package/dist/stylelint/index.js +7 -6
  60. package/dist/utils/resolver.d.ts +20 -10
  61. package/dist/utils/resolver.js +28 -10
  62. package/dist/utils/utils.d.ts +1 -1
  63. package/dist/utils/utils.js +1 -1
  64. package/docs/eslint/README.md +3 -30
  65. package/docs/stylelint/README.md +3 -30
  66. package/package.json +3 -3
@@ -1,4 +1,3 @@
1
- import { defineConfig } from "@eslint/config-helpers";
2
1
  import { flattenDeepArrays } from "../../utils/utils.js";
3
2
  // constants ==================================================================
4
3
  /**
@@ -67,22 +66,8 @@ export function extGlob(extensions) {
67
66
  return extensions.map(ext => "**/*." + ext);
68
67
  }
69
68
  /**
70
- * A version of ESLint's `defineConfig` that flattens multiple configuration
71
- * objects or deeply nested arrays into a flat array while skipping all falsy
72
- * parameters.
73
- *
74
- * @param configs
75
- * The configuration objects to be flattened and filtered.
76
- *
77
- * @returns
78
- * The flattened configuration array.
79
- */
80
- export function createConfigArray(...configs) {
81
- return defineConfig(flattenDeepArrays(configs));
82
- }
83
- /**
84
- * Creates a flat configuration object with "files" and "ignores" settings from
85
- * an environment's "envOptions" object.
69
+ * Creates a configuration entry with "files" and "ignores" settings from an
70
+ * environment's "envOptions" object.
86
71
  *
87
72
  * @param name
88
73
  * The name of the configuration entry.
@@ -90,28 +75,28 @@ export function createConfigArray(...configs) {
90
75
  * @param envOptions
91
76
  * The environment options containing "files" and "ignores" settings.
92
77
  *
93
- * @param flatConfig
94
- * Properties for the flat configuration to be built. Additional "files" and
78
+ * @param config
79
+ * Properties for the configuration entry to be built. Additional "files" and
95
80
  * "ignores" properties will be merged with the settings from "envOptions".
96
81
  *
97
82
  * @param rules
98
83
  * Hard-coded rule settings to be added to the configuration.
99
84
  *
100
85
  * @returns
101
- * The resulting flat configuration object.
86
+ * The resulting configuration entry.
102
87
  */
103
- export function createConfig(name, envOptions, flatConfig, rules) {
88
+ export function createConfig(name, envOptions, config, rules) {
104
89
  return {
105
90
  name,
106
- ...flatConfig,
107
- files: flattenDeepArrays(envOptions.files, flatConfig.files),
108
- ignores: flattenDeepArrays(envOptions.ignores, flatConfig.ignores),
109
- rules: { ...flatConfig.rules, ...rules },
91
+ ...config,
92
+ files: flattenDeepArrays(envOptions.files, config.files),
93
+ ignores: flattenDeepArrays(envOptions.ignores, config.ignores),
94
+ rules: { ...config.rules, ...rules },
110
95
  };
111
96
  }
112
97
  /**
113
- * Creates a flat configuration object with "files", "ignores", and "rules"
114
- * settings from an environment's "envOptions" object.
98
+ * Creates a configuration entry with "files", "ignores", and "rules" settings
99
+ * from an environment's "envOptions" object.
115
100
  *
116
101
  * @param name
117
102
  * The name of the configuration entry.
@@ -126,7 +111,7 @@ export function createConfig(name, envOptions, flatConfig, rules) {
126
111
  * allow to override them.
127
112
  *
128
113
  * @returns
129
- * The resulting flat configuration object, if the environment options contain
114
+ * The resulting configuration entry, if the environment options contain
130
115
  * custom rule settings, otherwise `undefined`.
131
116
  */
132
117
  export function customRules(name, envOptions, rules) {
@@ -145,9 +130,10 @@ export function customRules(name, envOptions, rules) {
145
130
  * @returns
146
131
  * The fixed configuration options.
147
132
  */
148
- export function fixMissingFilesOption(configs) {
149
- const files = configs.find(config => !!config.files)?.files;
150
- return files ? configs.map(config => (!config.files && (config.languageOptions || config.rules)) ? { ...config, files } : config) : configs;
133
+ export function fixMissingFilesOption(...configs) {
134
+ const flatConfigs = flattenDeepArrays(configs);
135
+ const files = flatConfigs.find(config => !!config.files)?.files;
136
+ return files ? flatConfigs.map(config => (!config.files && (config.languageOptions || config.rules)) ? { ...config, files } : config) : flatConfigs;
151
137
  }
152
138
  /**
153
139
  * Converts all warnings in the passed rule options to errors.
@@ -1,5 +1,5 @@
1
1
  import type { Linter } from "eslint";
2
- import type { EnvFilesOptions, EnvBaseOptions } from "./env-utils.js";
2
+ import type { ConfigWithExtendsArg, EnvFilesOptions, EnvBaseOptions } from "./env-utils.js";
3
3
  /**
4
4
  * Configuration for a single banned global or import.
5
5
  */
@@ -85,6 +85,6 @@ export declare function builtinRestrictedRules(): Linter.RulesRecord;
85
85
  * The fixed restricted items provided by the environment preset.
86
86
  *
87
87
  * @returns
88
- * The flat configuration objects needed to forbid the restricted items.
88
+ * The configuration entries needed to forbid the restricted items.
89
89
  */
90
- export declare function restrictedRulesConfig(baseName: string, envOptions: EnvRestrictedOptions, fixed?: EnvRestrictedItems): Linter.Config[];
90
+ export declare function restrictedRulesConfig(baseName: string, envOptions: EnvRestrictedOptions, fixed?: EnvRestrictedItems): ConfigWithExtendsArg;
@@ -1,5 +1,5 @@
1
1
  import { flattenDeepArrays } from "../../utils/utils.js";
2
- import { createConfigArray, createConfig } from "./env-utils.js";
2
+ import { createConfig } from "./env-utils.js";
3
3
  // functions ==================================================================
4
4
  /**
5
5
  * Creates a rules record for all restricted items.
@@ -77,20 +77,21 @@ export function builtinRestrictedRules() {
77
77
  * The fixed restricted items provided by the environment preset.
78
78
  *
79
79
  * @returns
80
- * The flat configuration objects needed to forbid the restricted items.
80
+ * The configuration entries needed to forbid the restricted items.
81
81
  */
82
82
  export function restrictedRulesConfig(baseName, envOptions, fixed) {
83
83
  const { restricted } = envOptions;
84
84
  // restricted items for all files in the environment
85
85
  const items = mergeRestrictedItems(fixed, restricted);
86
86
  // generate the configuration objects
87
- return createConfigArray(
88
- // base rules for all files in the environment
89
- createConfig(baseName, envOptions, {
90
- rules: createRulesRecord(key => items[key]),
91
- }),
92
- // generate the override entries (join with base items)
93
- restricted?.overrides?.map((override, index) => createConfig(`${baseName}-override-${index}`, override, {
94
- rules: createRulesRecord(key => flattenDeepArrays(items[key], override[key])),
95
- })));
87
+ return [
88
+ // base rules for all files in the environment
89
+ createConfig(baseName, envOptions, {
90
+ rules: createRulesRecord(key => items[key]),
91
+ }),
92
+ // generate the override entries (join with base items)
93
+ restricted?.overrides?.map((override, index) => createConfig(`${baseName}-override-${index}`, override, {
94
+ rules: createRulesRecord(key => flattenDeepArrays(items[key], override[key])),
95
+ })),
96
+ ];
96
97
  }
@@ -1,5 +1,4 @@
1
- import type { Linter } from "eslint";
2
- import { type EnvBaseOptions } from "./env-utils.js";
1
+ import type { ConfigWithExtendsArg, EnvBaseOptions } from "./env-utils.js";
3
2
  /**
4
3
  * Shared options for environment presets for unit tests.
5
4
  */
@@ -27,7 +26,7 @@ export interface EnvUnitTestOptions extends EnvBaseOptions {
27
26
  testingLib?: "angular" | "dom" | "marko" | "react" | "vue";
28
27
  }
29
28
  /**
30
- * Conditionally creates flat configuration objects for the ESLint plugins
29
+ * Conditionally creates configuration entries for the ESLint plugins
31
30
  * `eslint-plugin-jest-dom` and `eslint-plugin-testing-library`.
32
31
  *
33
32
  * @param baseName
@@ -37,6 +36,6 @@ export interface EnvUnitTestOptions extends EnvBaseOptions {
37
36
  * The configuration options for the unit test environment.
38
37
  *
39
38
  * @returns
40
- * The resulting flat configuration objects.
39
+ * The resulting configuration entries.
41
40
  */
42
- export declare function createUnitTestPluginConfigs(baseName: string, envOptions: EnvUnitTestOptions): Linter.Config[];
41
+ export declare function createUnitTestPluginConfigs(baseName: string, envOptions: EnvUnitTestOptions): ConfigWithExtendsArg;
@@ -1,10 +1,10 @@
1
1
  import extendedPlugin from "eslint-plugin-jest-extended";
2
2
  import jestDomPlugin from "eslint-plugin-jest-dom";
3
3
  import testingLibraryPlugin from "eslint-plugin-testing-library";
4
- import { createConfigArray, createConfig } from "./env-utils.js";
4
+ import { createConfig } from "./env-utils.js";
5
5
  // functions ==================================================================
6
6
  /**
7
- * Conditionally creates flat configuration objects for the ESLint plugins
7
+ * Conditionally creates configuration entries for the ESLint plugins
8
8
  * `eslint-plugin-jest-dom` and `eslint-plugin-testing-library`.
9
9
  *
10
10
  * @param baseName
@@ -14,24 +14,25 @@ import { createConfigArray, createConfig } from "./env-utils.js";
14
14
  * The configuration options for the unit test environment.
15
15
  *
16
16
  * @returns
17
- * The resulting flat configuration objects.
17
+ * The resulting configuration entries.
18
18
  */
19
19
  export function createUnitTestPluginConfigs(baseName, envOptions) {
20
- return createConfigArray(
21
- // "jest-extended" plugin (config "flat/recommended" is empty)
22
- envOptions.jestExtended && createConfig(`${baseName}:extended`, envOptions, extendedPlugin.configs["flat/all"]),
23
- // "jest-dom" plugin
24
- envOptions.jestDom && createConfig(`${baseName}:jest-dom`, envOptions, jestDomPlugin.configs["flat/recommended"]),
25
- // "testing-library" plugin
26
- envOptions.testingLib && createConfig(`${baseName}:testing-library`, envOptions, {
27
- // register rule implementations of the plugins
28
- plugins: {
29
- "testing-library": testingLibraryPlugin,
30
- },
31
- // recommended rules
32
- rules: {
33
- ...testingLibraryPlugin.configs["flat/react"].rules,
34
- "testing-library/no-node-access": ["error", { allowContainerFirstChild: true }],
35
- },
36
- }));
20
+ return [
21
+ // "jest-extended" plugin (config "flat/recommended" is empty)
22
+ envOptions.jestExtended && createConfig(`${baseName}:extended`, envOptions, extendedPlugin.configs["flat/all"]),
23
+ // "jest-dom" plugin
24
+ envOptions.jestDom && createConfig(`${baseName}:jest-dom`, envOptions, jestDomPlugin.configs["flat/recommended"]),
25
+ // "testing-library" plugin
26
+ envOptions.testingLib && createConfig(`${baseName}:testing-library`, envOptions, {
27
+ // register rule implementations of the plugins
28
+ plugins: {
29
+ "testing-library": testingLibraryPlugin,
30
+ },
31
+ // recommended rules
32
+ rules: {
33
+ ...testingLibraryPlugin.configs["flat/react"].rules,
34
+ "testing-library/no-node-access": ["error", { allowContainerFirstChild: true }],
35
+ },
36
+ }),
37
+ ];
37
38
  }
@@ -1,5 +1,4 @@
1
1
  import type { Config } from "stylelint";
2
- export * from "../utils/resolver.js";
3
2
  /**
4
3
  * Configuration options for StyleLint code style rules.
5
4
  */
@@ -20,15 +19,19 @@ export interface StylisticOptions {
20
19
  /**
21
20
  * Configuration options for linting the entire project with StyleLint.
22
21
  */
23
- export interface ConfigureOptions {
22
+ export interface ProjectOptions {
23
+ /**
24
+ * The URL of the project root containing the StyleLint configuration file.
25
+ * Should usually be set to `import.meta.url`.
26
+ */
27
+ root: string;
24
28
  /**
25
29
  * Glob patterns with all files and folders to be ignored by StyleLint.
26
30
  */
27
31
  ignores?: string[];
28
32
  /**
29
- * Full path to the template file containing the license header to be used
30
- * in all source files. The function `resolver` helps to to convert a local
31
- * path to an absolute path.
33
+ * Path to the template file containing the license header to be used in
34
+ * all source files. May be a path relative to the project root.
32
35
  */
33
36
  license?: string;
34
37
  /**
@@ -50,4 +53,4 @@ export interface ConfigureOptions {
50
53
  * @returns
51
54
  * The configuration object to be exported from `stylelint.config.js`.
52
55
  */
53
- export declare function defineConfig(options?: ConfigureOptions): Config;
56
+ export declare function defineConfig(options: ProjectOptions): Config;
@@ -1,5 +1,4 @@
1
- // re-exports =================================================================
2
- export * from "../utils/resolver.js";
1
+ import { PathResolver } from "../utils/resolver.js";
3
2
  // functions ==================================================================
4
3
  /**
5
4
  * Generates a StyleLint configuration object targeting the source files in the
@@ -18,16 +17,16 @@ export function defineConfig(options) {
18
17
  "coverage", // Vitest
19
18
  ".nuxt", // NuxtJS
20
19
  ".output", // NuxtJS
21
- ...(options?.ignores ?? []),
20
+ ...(options.ignores ?? []),
22
21
  ];
23
22
  // resolve stylistic configuration options
24
23
  const stylistic = {
25
24
  indent: 4,
26
25
  quotes: "double",
27
- ...options?.stylistic,
26
+ ...options.stylistic,
28
27
  };
29
28
  const rules = { base: {}, scss: {}, less: {} };
30
- for (const [rule, value] of Object.entries(options?.rules ?? {})) {
29
+ for (const [rule, value] of Object.entries(options.rules ?? {})) {
31
30
  const key = rule.split("/")[0];
32
31
  (rules[key] ?? rules.base)[rule] = value;
33
32
  }
@@ -37,6 +36,8 @@ export function defineConfig(options) {
37
36
  "scss/double-slash-comment-empty-line-before": null,
38
37
  ...rules.scss,
39
38
  };
39
+ // the resolver for relative file paths
40
+ const resolver = new PathResolver(options.root);
40
41
  return {
41
42
  // ignore certain files and folders
42
43
  ignoreFiles,
@@ -73,7 +74,7 @@ export function defineConfig(options) {
73
74
  "rule-empty-line-before": null,
74
75
  "shorthand-property-no-redundant-values": [true, { ignore: ["four-into-three-edge-values"] }],
75
76
  // license-header plugin
76
- ...(options?.license ? { "plugin/license-header": [true, { license: options.license }] } : null),
77
+ ...(options.license ? { "plugin/license-header": [true, { license: resolver.path(options.license) }] } : null),
77
78
  // stylistic plugin
78
79
  "@stylistic/declaration-colon-newline-after": null,
79
80
  "@stylistic/indentation": [stylistic.indent, { ignore: ["inside-parens"] }],
@@ -1,12 +1,22 @@
1
- export type FileResolveFn = (file: string) => string;
2
1
  /**
3
- * Creates and returns a resolver function for file paths relative to the given
4
- * base URL of a script file.
5
- *
6
- * @param url
7
- * The base URL of the calling script, usually `import.meta.url`.
8
- *
9
- * @returns
10
- * A function that converts relative file paths to absolute file paths.
2
+ * A resolver for file paths relative to a base URL.
11
3
  */
12
- export declare function createResolver(url: string): FileResolveFn;
4
+ export declare class PathResolver {
5
+ #private;
6
+ constructor(url: string);
7
+ /**
8
+ * @returns
9
+ * The directory path of the URL passed to the constructor.
10
+ */
11
+ get root(): string;
12
+ /**
13
+ * Converts a file path relative to "root" to an absolute file path.
14
+ *
15
+ * @param file
16
+ * The file path to be converted.
17
+ *
18
+ * @returns
19
+ * The absolute file path.
20
+ */
21
+ path(file: string): string;
22
+ }
@@ -1,15 +1,33 @@
1
+ import { dirname } from "node:path";
1
2
  import { URL, fileURLToPath } from "node:url";
2
3
  // functions ==================================================================
3
4
  /**
4
- * Creates and returns a resolver function for file paths relative to the given
5
- * base URL of a script file.
6
- *
7
- * @param url
8
- * The base URL of the calling script, usually `import.meta.url`.
9
- *
10
- * @returns
11
- * A function that converts relative file paths to absolute file paths.
5
+ * A resolver for file paths relative to a base URL.
12
6
  */
13
- export function createResolver(url) {
14
- return file => fileURLToPath(new URL(file, url));
7
+ export class PathResolver {
8
+ #url;
9
+ #root;
10
+ constructor(url) {
11
+ this.#url = url;
12
+ this.#root = dirname(fileURLToPath(url));
13
+ }
14
+ /**
15
+ * @returns
16
+ * The directory path of the URL passed to the constructor.
17
+ */
18
+ get root() {
19
+ return this.#root;
20
+ }
21
+ /**
22
+ * Converts a file path relative to "root" to an absolute file path.
23
+ *
24
+ * @param file
25
+ * The file path to be converted.
26
+ *
27
+ * @returns
28
+ * The absolute file path.
29
+ */
30
+ path(file) {
31
+ return fileURLToPath(new URL(file, this.#url));
32
+ }
15
33
  }
@@ -17,7 +17,7 @@ export type DeepOptArray<T> = T | false | null | undefined | ReadonlyArray<DeepO
17
17
  */
18
18
  export declare function yieldDeepArrays<T>(...arrays: Array<DeepOptArray<T>>): IterableIterator<T>;
19
19
  /**
20
- * Returns a flat array all truthy elements of all deeply nested arrays.
20
+ * Returns a flat array with all truthy elements of all deeply nested arrays.
21
21
  *
22
22
  * @template T
23
23
  * The element type of the array.
@@ -24,7 +24,7 @@ export function* yieldDeepArrays(...arrays) {
24
24
  }
25
25
  }
26
26
  /**
27
- * Returns a flat array all truthy elements of all deeply nested arrays.
27
+ * Returns a flat array with all truthy elements of all deeply nested arrays.
28
28
  *
29
29
  * @template T
30
30
  * The element type of the array.
@@ -4,31 +4,6 @@ The module `eslint` provides a `defineConfig` function to create a project-wide
4
4
 
5
5
  ## Functions
6
6
 
7
- ### Function `createResolver`
8
-
9
- Creates and returns a function that will convert relative file paths to absolute file paths. Intended to be used with the base URL of the calling script, usually `import.meta.url`.
10
-
11
- #### `createResolver` Signature
12
-
13
- ```ts
14
- function createResolver(url: string): (file: string) => string;
15
- ```
16
-
17
- #### `createResolver` Example
18
-
19
- ```js
20
- // eslint.config.ts
21
- import { createResolver, defineConfig } from "@open-xchange/linter-presets/eslint";
22
-
23
- const resolve = createResolver(import.meta.url);
24
-
25
- export default defineConfig({
26
- // ...
27
- license: resolve("./license.txt"),
28
- // ...
29
- });
30
- ```
31
-
32
7
  ### Function `defineConfig`
33
8
 
34
9
  Generates standard configuration targeting the source files in the entire project, and allows to add more custom configuration entries. Internally, various ESLint plugins will be included and configured to use their recommended rule sets.
@@ -53,7 +28,7 @@ Generates standard configuration targeting the source files in the entire projec
53
28
  #### `defineConfig` Signature
54
29
 
55
30
  ```ts
56
- function defineConfig(options: ConfigureOptions, ...configs: ConfigWithExtendsArg[]): Linter.Config[];
31
+ function defineConfig(options: ProjectOptions, ...configs: ConfigWithExtendsArg[]): Linter.Config[];
57
32
  ```
58
33
 
59
34
  After the mandatory `options` parameters, the function can take multiple custom configuration objects or arrays, for example environment configuration presets (see below).
@@ -96,14 +71,12 @@ This package defines ignore globs for the following files and directories:
96
71
 
97
72
  ```ts
98
73
  // eslint.config.ts
99
- import { createResolver, defineConfig } from "@open-xchange/linter-presets/eslint";
100
-
101
- const resolve = createResolver(import.meta.url);
74
+ import { defineConfig } from "@open-xchange/linter-presets/eslint";
102
75
 
103
76
  export default defineConfig({
104
77
  ignores: ["external/**/*.yaml"],
105
78
  language: { ecmaVersion: 2024, sourceType: "commonjs" },
106
- license: resolve("./license.txt"),
79
+ license: "./license.txt",
107
80
  stylistic: { quotes: "single", semi: "never" },
108
81
  });
109
82
  ```
@@ -4,31 +4,6 @@ The module `stylelint` provides a `defineConfig` function for project-wide Style
4
4
 
5
5
  ## Functions
6
6
 
7
- ### Function `createResolver`
8
-
9
- Creates and returns a function that will convert relative file paths to absolute file paths. Intended to be used with the base URL of the calling script, usually `import.meta.url`.
10
-
11
- #### `createResolver` Signature
12
-
13
- ```ts
14
- function createResolver(url: string): (file: string) => string;
15
- ```
16
-
17
- #### `createResolver` Example
18
-
19
- ```js
20
- // stylelint.config.js
21
- import { createResolver, defineConfig } from "@open-xchange/linter-presets/stylelint";
22
-
23
- const resolve = createResolver(import.meta.url);
24
-
25
- export default defineConfig({
26
- // ...
27
- license: resolve("./license.txt"),
28
- // ...
29
- });
30
- ```
31
-
32
7
  ### Function `defineConfig`
33
8
 
34
9
  Generates standard configuration targeting the source files in the entire project. Internally, various StyleLint plugins will be included and configured to use their recommended rule sets.
@@ -45,7 +20,7 @@ Generates standard configuration targeting the source files in the entire projec
45
20
  ```ts
46
21
  import type { Config } from "stylelint";
47
22
 
48
- function defineConfig(options?: ConfigureOptions): Config;
23
+ function defineConfig(options?: ProjectOptions): Config;
49
24
  ```
50
25
 
51
26
  #### `defineConfig` Options
@@ -72,13 +47,11 @@ This package defines ignore globs for the following files and directories:
72
47
 
73
48
  ```ts
74
49
  // stylelint.config.js
75
- import { createResolver, defineConfig } from "@open-xchange/linter-presets/stylelint";
76
-
77
- const resolve = createResolver(import.meta.url);
50
+ import { defineConfig } from "@open-xchange/linter-presets/stylelint";
78
51
 
79
52
  export default defineConfig({
80
53
  ignores: ["external/**/*.scss"],
81
- license: resolve("./license.txt"),
54
+ license: "./license.txt",
82
55
  stylistic: { indent: 2, quotes: "single" },
83
56
  });
84
57
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/linter-presets",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Configuration presets for ESLint and StyleLint",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,7 +39,7 @@
39
39
  "@eslint/config-helpers": "^0.3.0",
40
40
  "@eslint/js": "^9.31.0",
41
41
  "@eslint/markdown": "^7.0.0",
42
- "@stylistic/eslint-plugin": "^5.1.0",
42
+ "@stylistic/eslint-plugin": "^5.2.0",
43
43
  "@stylistic/eslint-plugin-migrate": "^4.4.1",
44
44
  "@stylistic/stylelint-config": "^2.0.0",
45
45
  "@stylistic/stylelint-plugin": "^3.1.3",
@@ -53,7 +53,7 @@
53
53
  "eslint-plugin-jest": "^29.0.1",
54
54
  "eslint-plugin-jest-dom": "^5.5.0",
55
55
  "eslint-plugin-jest-extended": "^3.0.0",
56
- "eslint-plugin-jsdoc": "^51.4.0",
56
+ "eslint-plugin-jsdoc": "^51.4.1",
57
57
  "eslint-plugin-jsonc": "^2.20.1",
58
58
  "eslint-plugin-jsx-a11y": "^6.10.2",
59
59
  "eslint-plugin-license-header": "^0.8.0",