@nx/eslint 20.1.0-canary.20241030-62f58eb → 20.1.0-canary.20241101-d4f4dac

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/eslint",
3
- "version": "20.1.0-canary.20241030-62f58eb",
3
+ "version": "20.1.0-canary.20241101-d4f4dac",
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": {
@@ -35,8 +35,8 @@
35
35
  "eslint": "^8.0.0 || ^9.0.0"
36
36
  },
37
37
  "dependencies": {
38
- "@nx/devkit": "20.1.0-canary.20241030-62f58eb",
39
- "@nx/js": "20.1.0-canary.20241030-62f58eb",
38
+ "@nx/devkit": "20.1.0-canary.20241101-d4f4dac",
39
+ "@nx/js": "20.1.0-canary.20241101-d4f4dac",
40
40
  "semver": "^7.5.3",
41
41
  "tslib": "^2.3.0",
42
42
  "typescript": "~5.4.2"
@@ -184,7 +184,8 @@ function createEsLintConfiguration(tree, options, projectConfig, setParserOption
184
184
  });
185
185
  const nodeList = (0, ast_utils_1.createNodeList)(importMap, nodes);
186
186
  const content = (0, ast_utils_1.stringifyNodeList)(nodeList);
187
- tree.write((0, path_1.join)(projectConfig.root, 'eslint.config.js'), content);
187
+ const ext = extendedRootConfig?.endsWith('.cjs') ? '.cjs' : '.js';
188
+ tree.write((0, path_1.join)(projectConfig.root, `eslint.config${ext}`), content);
188
189
  }
189
190
  else {
190
191
  (0, devkit_1.writeJson)(tree, (0, path_1.join)(projectConfig.root, `.eslintrc.json`), {
@@ -40,7 +40,9 @@ function isEslintConfigSupported(tree, projectRoot = '') {
40
40
  if (!eslintFile) {
41
41
  return false;
42
42
  }
43
- return eslintFile.endsWith('.json') || eslintFile.endsWith('.config.js');
43
+ return (eslintFile.endsWith('.json') ||
44
+ eslintFile.endsWith('.config.js') ||
45
+ eslintFile.endsWith('.config.cjs'));
44
46
  }
45
47
  function updateRelativePathsInConfig(tree, sourcePath, destinationPath) {
46
48
  if (sourcePath === destinationPath ||
@@ -729,14 +729,14 @@ function addTSObjectProperty(elements, key, value) {
729
729
  */
730
730
  function generateAst(input, propertyAssignmentReplacer) {
731
731
  if (Array.isArray(input)) {
732
- return ts.factory.createArrayLiteralExpression(input.map((item) => generateAst(item, propertyAssignmentReplacer)), input.length > 1 // multiline only if more than one item
732
+ return ts.factory.createArrayLiteralExpression(input.map((item) => generateAst(item, propertyAssignmentReplacer)), true // Always treat as multiline, using item.length does not work in all cases
733
733
  );
734
734
  }
735
735
  if (input === null) {
736
736
  return ts.factory.createNull();
737
737
  }
738
738
  if (typeof input === 'object') {
739
- return ts.factory.createObjectLiteralExpression(generatePropertyAssignmentsFromObjectEntries(input, propertyAssignmentReplacer), Object.keys(input).length > 1 // multiline only if more than one property
739
+ return ts.factory.createObjectLiteralExpression(generatePropertyAssignmentsFromObjectEntries(input, propertyAssignmentReplacer), true // Always treat as multiline, using Object.keys(input).length > 1 does not work in all cases
740
740
  );
741
741
  }
742
742
  if (typeof input === 'string') {