@nx/eslint 18.2.0-canary.20240320-64b2396 → 18.2.0-canary.20240322-61cb63d

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/eslint",
3
- "version": "18.2.0-canary.20240320-64b2396",
3
+ "version": "18.2.0-canary.20240322-61cb63d",
4
4
  "private": false,
5
5
  "description": "The ESLint plugin for Nx contains executors, generators and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.",
6
6
  "repository": {
@@ -33,12 +33,12 @@
33
33
  "js-yaml": "4.1.0"
34
34
  },
35
35
  "dependencies": {
36
- "@nx/devkit": "18.2.0-canary.20240320-64b2396",
37
- "@nx/js": "18.2.0-canary.20240320-64b2396",
36
+ "@nx/devkit": "18.2.0-canary.20240322-61cb63d",
37
+ "@nx/js": "18.2.0-canary.20240322-61cb63d",
38
38
  "eslint": "^8.0.0",
39
39
  "tslib": "^2.3.0",
40
40
  "typescript": "~5.4.2",
41
- "@nx/linter": "18.2.0-canary.20240320-64b2396"
41
+ "@nx/linter": "18.2.0-canary.20240322-61cb63d"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "js-yaml": {
@@ -104,6 +104,10 @@ function migrateEslintFile(projectEslintPath, tree) {
104
104
  }
105
105
  // add extends
106
106
  json.extends = json.extends || [];
107
+ // ensure extends is an array
108
+ if (typeof json.extends === 'string') {
109
+ json.extends = [json.extends];
110
+ }
107
111
  const pathToRootConfig = `${(0, devkit_1.offsetFromRoot)((0, path_1.dirname)(projectEslintPath))}${baseFile}`;
108
112
  if (json.extends.indexOf(pathToRootConfig) === -1) {
109
113
  json.extends.push(pathToRootConfig);
@@ -502,15 +502,24 @@ function generateFlatOverride(override) {
502
502
  !override.extends &&
503
503
  !override.plugins &&
504
504
  !override.parser) {
505
+ if (override.parserOptions) {
506
+ const { parserOptions, ...rest } = override;
507
+ return generateAst({ ...rest, languageSettings: { parserOptions } });
508
+ }
505
509
  return generateAst(override);
506
510
  }
507
- const { files, excludedFiles, rules, ...rest } = override;
511
+ const { files, excludedFiles, rules, parserOptions, ...rest } = override;
508
512
  const objectLiteralElements = [
509
513
  ts.factory.createSpreadAssignment(ts.factory.createIdentifier('config')),
510
514
  ];
511
515
  addTSObjectProperty(objectLiteralElements, 'files', files);
512
516
  addTSObjectProperty(objectLiteralElements, 'excludedFiles', excludedFiles);
513
517
  addTSObjectProperty(objectLiteralElements, 'rules', rules);
518
+ if (parserOptions) {
519
+ addTSObjectProperty(objectLiteralElements, 'languageSettings', {
520
+ parserOptions,
521
+ });
522
+ }
514
523
  return ts.factory.createSpreadElement(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('compat'), ts.factory.createIdentifier('config')), undefined, [generateAst(rest)]), ts.factory.createIdentifier('map')), undefined, [
515
524
  ts.factory.createArrowFunction(undefined, undefined, [
516
525
  ts.factory.createParameterDeclaration(undefined, undefined, 'config'),