@open-xchange/linter-presets 1.2.1 → 1.2.2

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,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## `1.2.2` – 2025-Jan-11
4
+
5
+ - fix: (ESLint) support all configuration file extensions
6
+
3
7
  ## `1.2.1` – 2025-Jan-10
4
8
 
5
9
  - chore: bump dependencies
@@ -6,6 +6,14 @@ import { findUpSync } from "find-up";
6
6
  import { AST_NODE_TYPES as NodeType } from "@typescript-eslint/utils";
7
7
  // constants ==================================================================
8
8
  const FILE_EXTENSIONS = ["js", "ts", "d.ts"];
9
+ const CONFIG_FILES = [
10
+ "eslint.config.js",
11
+ "eslint.config.mjs",
12
+ "eslint.config.cjs",
13
+ "eslint.config.ts",
14
+ "eslint.config.mts",
15
+ "eslint.config.cts",
16
+ ];
9
17
  // Schema =====================================================================
10
18
  /**
11
19
  * Helper functions to build a JSON schema for custom ESLint rules.
@@ -133,10 +141,13 @@ export class ProjectContext {
133
141
  const sharedSettings = context.settings["env-project"];
134
142
  this.#aliasMap = new Map(Object.entries(sharedSettings?.alias ?? {}));
135
143
  // resolve root directory
136
- const configPath = findUpSync("eslint.config.js");
137
- const rootDir = configPath && toPosixPath(dirname(configPath));
144
+ const configPath = findUpSync(CONFIG_FILES);
145
+ if (!configPath) {
146
+ throw new Error("cannot find configuration file");
147
+ }
148
+ const rootDir = toPosixPath(dirname(configPath));
138
149
  const fileName = toPosixPath(context.filename);
139
- if (!rootDir || !fileName.startsWith(rootDir + "/")) {
150
+ if (!fileName.startsWith(rootDir + "/")) {
140
151
  throw new Error("invalid root directory");
141
152
  }
142
153
  this.#rootDir = rootDir;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/linter-presets",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Configuration presets for ESLint and StyleLint",
5
5
  "repository": {
6
6
  "type": "git",