@angular-eslint/builder 17.5.3-alpha.0 → 17.5.3-alpha.1

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 CHANGED
@@ -1 +1,7 @@
1
1
  # @angular-eslint/builder
2
+
3
+ Please see https://github.com/angular-eslint/angular-eslint for full usage instructions and guidance.
4
+
5
+ The `@angular-eslint/builder` package is a custom Angular CLI builder that allows you to run ESLint on your Angular CLI projects.
6
+
7
+ It wraps the ESLint programmatic node API (https://eslint.org/docs/latest/integrate/nodejs-api) to provide a seamless experience via `ng lint` that is closely equivalent to using the `eslint` CLI directly.
@@ -1 +1 @@
1
- {"version":3,"file":"eslint-utils.d.ts","sourceRoot":"","sources":["../../src/utils/eslint-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAiBxC,wBAAsB,2BAA2B,CAC/C,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,OAAO,EAAE,MAAM,EACf,aAAa,UAAQ;;;GAoEtB"}
1
+ {"version":3,"file":"eslint-utils.d.ts","sourceRoot":"","sources":["../../src/utils/eslint-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAuBxC,wBAAsB,2BAA2B,CAC/C,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,OAAO,EAAE,MAAM,EACf,aAAa,UAAQ;;;GAyEtB"}
@@ -3,8 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveAndInstantiateESLint = void 0;
4
4
  async function resolveESLintClass(useFlatConfig = false) {
5
5
  try {
6
+ // In eslint 8.57.0 (the final v8 version), a dedicated API was added for resolving the correct ESLint class.
7
+ const eslint = await import('eslint');
8
+ if (typeof eslint.loadESLint === 'function') {
9
+ return await eslint.loadESLint({ useFlatConfig });
10
+ }
11
+ // If that API is not available (an older version of v8), we need to use the old way of resolving the ESLint class.
6
12
  if (!useFlatConfig) {
7
- return (await import('eslint')).ESLint;
13
+ return eslint.ESLint;
8
14
  }
9
15
  // eslint-disable-next-line @typescript-eslint/no-var-requires
10
16
  const { FlatESLint } = require('eslint/use-at-your-own-risk');
@@ -38,7 +44,6 @@ async function resolveAndInstantiateESLint(eslintConfigPath, options, useFlatCon
38
44
  * not be any html files in the project, so keeping it true would break linting every time
39
45
  */
40
46
  errorOnUnmatchedPattern: false,
41
- reportUnusedDisableDirectives: options.reportUnusedDisableDirectives || undefined,
42
47
  };
43
48
  if (useFlatConfig) {
44
49
  if (typeof options.useEslintrc !== 'undefined') {
@@ -50,6 +55,9 @@ async function resolveAndInstantiateESLint(eslintConfigPath, options, useFlatCon
50
55
  if (options.ignorePath !== undefined) {
51
56
  throw new Error('For Flat Config, ESLint removed `ignorePath` and so it is not supported as an option. See https://eslint.org/docs/latest/use/configure/configuration-files-new');
52
57
  }
58
+ if (options.reportUnusedDisableDirectives) {
59
+ throw new Error('For Flat Config, ESLint removed `reportedUnusedDisableDirectives` and so it is not supported as an option. See https://eslint.org/docs/latest/use/configure/configuration-files-new');
60
+ }
53
61
  }
54
62
  else {
55
63
  eslintOptions.rulePaths = options.rulesdir || [];
@@ -61,6 +69,8 @@ async function resolveAndInstantiateESLint(eslintConfigPath, options, useFlatCon
61
69
  * merge the provided config with others it finds automatically.
62
70
  */
63
71
  eslintOptions.useEslintrc = !options.noEslintrc;
72
+ eslintOptions.reportUnusedDisableDirectives =
73
+ options.reportUnusedDisableDirectives || undefined;
64
74
  }
65
75
  const eslint = new ESLint(eslintOptions);
66
76
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/builder",
3
- "version": "17.5.3-alpha.0",
3
+ "version": "17.5.3-alpha.1",
4
4
  "description": "Angular CLI builder for ESLint",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -19,12 +19,12 @@
19
19
  "builders.json"
20
20
  ],
21
21
  "dependencies": {
22
- "@nx/devkit": "^17.2.8 || ^18.0.0 || ^19.0.0",
23
- "nx": "^17.2.8 || ^18.0.0 || ^19.0.0"
22
+ "@nx/devkit": "^19.0.6",
23
+ "nx": "^19.0.6"
24
24
  },
25
25
  "builders": "./builders.json",
26
26
  "peerDependencies": {
27
- "eslint": "^7.20.0 || ^8.0.0",
27
+ "eslint": "^8.57.0 || ^9.0.0",
28
28
  "typescript": "*"
29
29
  },
30
30
  "gitHead": "e2006e5e9c99e5a943d1a999e0efa5247d29ec24"