@angular-eslint/builder 18.3.2-alpha.16 → 18.3.2-alpha.17

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.
@@ -1 +1 @@
1
- {"version":3,"file":"lint.impl.d.ts","sourceRoot":"","sources":["../src/lint.impl.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;;AAMvC,wBAkME"}
1
+ {"version":3,"file":"lint.impl.d.ts","sourceRoot":"","sources":["../src/lint.impl.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;;AAMvC,wBA8LE"}
package/dist/lint.impl.js CHANGED
@@ -15,10 +15,6 @@ exports.default = (0, architect_1.createBuilder)(async (options, context) => {
15
15
  if (printInfo) {
16
16
  console.info(`\nLinting ${JSON.stringify(projectName)}...`);
17
17
  }
18
- /**
19
- * We want users to have the option of not specifying the config path, and let
20
- * eslint automatically resolve the `.eslintrc.json` files in each folder.
21
- */
22
18
  const eslintConfigPath = options.eslintConfig
23
19
  ? (0, path_1.resolve)(systemRoot, options.eslintConfig)
24
20
  : undefined;
@@ -50,7 +46,8 @@ exports.default = (0, architect_1.createBuilder)(async (options, context) => {
50
46
  const projectMetadata = await context.getProjectMetadata(projectName);
51
47
  if (projectMetadata?.root) {
52
48
  const { root } = projectMetadata;
53
- eslintConfigPathForError = `\`${root}/.eslintrc.json\``;
49
+ eslintConfigPathForError =
50
+ resolveESLintConfigPath(root) ?? '';
54
51
  }
55
52
  console.error(`
56
53
  Error: You have attempted to use a lint rule which requires the full TypeScript type-checker to be available, but you do not have \`parserOptions.project\` configured to point at your project tsconfig.json files in the relevant TypeScript file "overrides" block of your project ESLint config ${eslintConfigPath || eslintConfigPathForError}
@@ -110,7 +107,6 @@ For full guidance on how to resolve this issue, please see https://github.com/an
110
107
  * log (even when no results) because different formatters handled the
111
108
  * "no results" case differently.
112
109
  */
113
- // @ts-expect-error - TODO: investigate this new rules meta argument to this function in ESLint v9
114
110
  const formattedResults = await formatter.format(finalLintResults);
115
111
  if (options.outputFile) {
116
112
  const pathToOutputFile = (0, path_1.join)(systemRoot, options.outputFile);
@@ -139,3 +135,22 @@ For full guidance on how to resolve this issue, please see https://github.com/an
139
135
  success: options.force || (totalErrors === 0 && !tooManyWarnings),
140
136
  };
141
137
  });
138
+ function resolveESLintConfigPath(projectRoot) {
139
+ const rcPath = (0, path_1.join)(projectRoot, '.eslintrc.json');
140
+ if ((0, fs_1.existsSync)(rcPath)) {
141
+ return rcPath;
142
+ }
143
+ const jsPath = (0, path_1.join)(projectRoot, 'eslint.config.js');
144
+ if ((0, fs_1.existsSync)(jsPath)) {
145
+ return jsPath;
146
+ }
147
+ const mjsPath = (0, path_1.join)(projectRoot, 'eslint.config.mjs');
148
+ if ((0, fs_1.existsSync)(mjsPath)) {
149
+ return mjsPath;
150
+ }
151
+ const cjsPath = (0, path_1.join)(projectRoot, 'eslint.config.cjs');
152
+ if ((0, fs_1.existsSync)(cjsPath)) {
153
+ return cjsPath;
154
+ }
155
+ return null;
156
+ }
package/dist/schema.json CHANGED
@@ -91,7 +91,12 @@
91
91
  },
92
92
  "noEslintrc": {
93
93
  "type": "boolean",
94
- "description": "The equivalent of the `--no-eslintrc` flag on the ESLint CLI, it is false by default",
94
+ "description": "NOTE: eslintrc config only. The equivalent of the `--no-eslintrc` flag on the ESLint CLI, it is false by default",
95
+ "default": false
96
+ },
97
+ "noConfigLookup": {
98
+ "type": "boolean",
99
+ "description": "NOTE: flat config only. The equivalent of the `--no-config-lookup` flag on the ESLint CLI, it is false by default",
95
100
  "default": false
96
101
  },
97
102
  "rulesdir": {
@@ -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;AAExC,eAAO,MAAM,wBAAwB,UAIpC,CAAC;AAuBF,wBAAsB,2BAA2B,CAC/C,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,OAAO,EAAE,MAAM,EACf,aAAa,UAAQ;;;GA0EtB"}
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;AAExC,eAAO,MAAM,wBAAwB,UAIpC,CAAC;AAuBF,wBAAsB,2BAA2B,CAC/C,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,OAAO,EAAE,MAAM,EACf,aAAa,UAAQ;;;GAyFtB"}
@@ -34,7 +34,6 @@ async function resolveAndInstantiateESLint(eslintConfigPath, options, useFlatCon
34
34
  }
35
35
  const ESLint = await resolveESLintClass(useFlatConfig);
36
36
  const eslintOptions = {
37
- overrideConfigFile: eslintConfigPath,
38
37
  fix: !!options.fix,
39
38
  cache: !!options.cache,
40
39
  cacheLocation: options.cacheLocation || undefined,
@@ -64,8 +63,23 @@ async function resolveAndInstantiateESLint(eslintConfigPath, options, useFlatCon
64
63
  if (options.reportUnusedDisableDirectives) {
65
64
  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');
66
65
  }
66
+ /**
67
+ * Adapted from https://github.com/eslint/eslint/blob/50f03a119e6827c03b1d6c86d3aa1f4820b609e8/lib/cli.js#L144
68
+ */
69
+ if (typeof options.noConfigLookup !== 'undefined') {
70
+ const configLookup = !options.noConfigLookup;
71
+ let overrideConfigFile = typeof eslintConfigPath === 'string' ? eslintConfigPath : !configLookup;
72
+ if (overrideConfigFile === false) {
73
+ overrideConfigFile = undefined;
74
+ }
75
+ eslintOptions.overrideConfigFile = overrideConfigFile;
76
+ }
77
+ else {
78
+ eslintOptions.overrideConfigFile = eslintConfigPath;
79
+ }
67
80
  }
68
81
  else {
82
+ eslintOptions.overrideConfigFile = eslintConfigPath;
69
83
  eslintOptions.rulePaths = options.rulesdir || [];
70
84
  eslintOptions.resolvePluginsRelativeTo =
71
85
  options.resolvePluginsRelativeTo || undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/builder",
3
- "version": "18.3.2-alpha.16",
3
+ "version": "18.3.2-alpha.17",
4
4
  "description": "Angular CLI builder for ESLint",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",