Skip to content

The open alternative to Salesforce, designed for AI.

Migrate eslint to mjs (#13850)

Charles Bochetbe8af1eb293d
diff --git a/eslint.config.js b/eslint.config.mjs
similarity index 100%
rename from eslint.config.js
rename to eslint.config.mjs
diff --git a/eslint.config.react.js b/eslint.config.react.mjs
similarity index 100%
rename from eslint.config.react.js
rename to eslint.config.react.mjs
diff --git a/nx.json b/nx.json
index e1cd347e778..845ac9917e5 100644
--- a/nx.json
+++ b/nx.json
@@ -4,9 +4,7 @@
"libsDir": "packages"
},
"namedInputs": {
- "default": [
- "{projectRoot}/**/*"
- ],
+ "default": ["{projectRoot}/**/*"],
"excludeStories": [
"default",
"!{projectRoot}/.storybook/*",
@@ -34,28 +32,19 @@
"targetDefaults": {
"build": {
"cache": true,
- "inputs": [
- "^production",
- "production"
- ],
- "dependsOn": [
- "^build"
- ]
+ "inputs": ["^production", "production"],
+ "dependsOn": ["^build"]
},
"start": {
"cache": true,
- "dependsOn": [
- "^build"
- ]
+ "dependsOn": ["^build"]
},
"lint": {
"executor": "@nx/eslint:lint",
"cache": true,
- "outputs": [
- "{options.outputFile}"
- ],
+ "outputs": ["{options.outputFile}"],
"options": {
- "eslintConfig": "{projectRoot}/eslint.config.js",
+ "eslintConfig": "{projectRoot}/eslint.config.mjs",
"cache": true,
"cacheLocation": "{workspaceRoot}/.cache/eslint"
},
@@ -67,9 +56,7 @@
"fix": true
}
},
- "dependsOn": [
- "^build"
- ]
+ "dependsOn": ["^build"]
},
"fmt": {
"executor": "nx:run-commands",
@@ -90,9 +77,7 @@
"write": true
}
},
- "dependsOn": [
- "^build"
- ]
+ "dependsOn": ["^build"]
},
"typecheck": {
"executor": "nx:run-commands",
@@ -106,30 +91,22 @@
"watch": true
}
},
- "dependsOn": [
- "^build"
- ]
+ "dependsOn": ["^build"]
},
"test": {
"executor": "@nx/jest:jest",
"cache": true,
- "dependsOn": [
- "^build"
- ],
+ "dependsOn": ["^build"],
"inputs": [
"^default",
"excludeStories",
"{workspaceRoot}/jest.preset.js"
],
- "outputs": [
- "{projectRoot}/coverage"
- ],
+ "outputs": ["{projectRoot}/coverage"],
"options": {
"jestConfig": "{projectRoot}/jest.config.ts",
"coverage": true,
- "coverageReporters": [
- "text-summary"
- ],
+ "coverageReporters": ["text-summary"],
"cacheDirectory": "../../.cache/jest/{projectRoot}"
},
"configurations": {
@@ -138,10 +115,7 @@
"maxWorkers": 3
},
"coverage": {
- "coverageReporters": [
- "lcov",
- "text"
- ]
+ "coverageReporters": ["lcov", "text"]
},
"watch": {
"watch": true
@@ -150,36 +124,25 @@
},
"test:e2e": {
"cache": true,
- "dependsOn": [
- "^build"
- ]
+ "dependsOn": ["^build"]
},
"storybook:build": {
"executor": "nx:run-commands",
"cache": true,
- "inputs": [
- "^default",
- "excludeTests"
- ],
- "outputs": [
- "{projectRoot}/{options.output-dir}"
- ],
+ "inputs": ["^default", "excludeTests"],
+ "outputs": ["{projectRoot}/{options.output-dir}"],
"options": {
"cwd": "{projectRoot}",
"command": "VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true storybook build --test",
"output-dir": "storybook-static",
"config-dir": ".storybook"
},
- "dependsOn": [
- "^build"
- ]
+ "dependsOn": ["^build"]
},
"storybook:serve:dev": {
"executor": "nx:run-commands",
"cache": true,
- "dependsOn": [
- "^build"
- ],
+ "dependsOn": ["^build"],
"options": {
"cwd": "{projectRoot}",
"command": "storybook dev",
@@ -188,9 +151,7 @@
},
"storybook:serve:static": {
"executor": "nx:run-commands",
- "dependsOn": [
- "storybook:build"
- ],
+ "dependsOn": ["storybook:build"],
"options": {
"cwd": "{projectRoot}",
"command": "npx http-server {args.staticDir} -a={args.host} --port={args.port} --silent={args.silent}",
@@ -203,13 +164,8 @@
"storybook:test": {
"executor": "nx:run-commands",
"cache": true,
- "inputs": [
- "^default",
- "excludeTests"
- ],
- "outputs": [
- "{projectRoot}/coverage/storybook"
- ],
+ "inputs": ["^default", "excludeTests"],
+ "outputs": ["{projectRoot}/coverage/storybook"],
"options": {
"cwd": "{projectRoot}",
"commands": [
@@ -225,10 +181,7 @@
},
"storybook:test:no-coverage": {
"executor": "nx:run-commands",
- "inputs": [
- "^default",
- "excludeTests"
- ],
+ "inputs": ["^default", "excludeTests"],
"options": {
"cwd": "{projectRoot}",
"commands": [
@@ -312,26 +265,18 @@
"cache": true,
"inputs": [
"default",
- "{workspaceRoot}/eslint.config.js",
+ "{workspaceRoot}/eslint.config.mjs",
"{workspaceRoot}/tools/eslint-rules/**/*"
]
},
"@nx/vite:test": {
"cache": true,
- "inputs": [
- "default",
- "^default"
- ]
+ "inputs": ["default", "^default"]
},
"@nx/vite:build": {
"cache": true,
- "dependsOn": [
- "^build"
- ],
- "inputs": [
- "default",
- "^default"
- ]
+ "dependsOn": ["^build"],
+ "inputs": ["default", "^default"]
}
},
"installation": {
@@ -363,12 +308,10 @@
"tasksRunnerOptions": {
"default": {
"options": {
- "cacheableOperations": [
- "storybook:build"
- ]
+ "cacheableOperations": ["storybook:build"]
}
}
},
"useInferencePlugins": false,
"defaultBase": "main"
-}
\ No newline at end of file
+}
diff --git a/packages/twenty-emails/eslint.config.js b/packages/twenty-emails/eslint.config.mjs
similarity index 93%
rename from packages/twenty-emails/eslint.config.js
rename to packages/twenty-emails/eslint.config.mjs
index 59edab96123..427bfa9d054 100644
--- a/packages/twenty-emails/eslint.config.js
+++ b/packages/twenty-emails/eslint.config.mjs
@@ -1,7 +1,7 @@
+import typescriptParser from '@typescript-eslint/parser';
import path from 'path';
import { fileURLToPath } from 'url';
-import typescriptParser from '@typescript-eslint/parser';
-import reactConfig from '../../eslint.config.react.js';
+import reactConfig from '../../eslint.config.react.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
diff --git a/packages/twenty-front/eslint.config.js b/packages/twenty-front/eslint.config.mjs
similarity index 94%
rename from packages/twenty-front/eslint.config.js
rename to packages/twenty-front/eslint.config.mjs
index d3b40ffb822..25acb896bee 100644
--- a/packages/twenty-front/eslint.config.js
+++ b/packages/twenty-front/eslint.config.mjs
@@ -1,7 +1,7 @@
import typescriptParser from '@typescript-eslint/parser';
import path from 'path';
import { fileURLToPath } from 'url';
-import reactConfig from '../../eslint.config.react.js';
+import reactConfig from '../../eslint.config.react.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@@ -63,6 +63,7 @@ const config = [
];
// Add CI-specific rules if in CI environment
+// eslint-disable-next-line no-undef
if (process.env.NX_TASK_TARGET_CONFIGURATION === 'ci') {
config.push({
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
diff --git a/packages/twenty-front/src/modules/object-metadata/utils/formatFieldMetadataItemAsFieldDefinition.ts b/packages/twenty-front/src/modules/object-metadata/utils/formatFieldMetadataItemAsFieldDefinition.ts
index e34d7198332..a7668cd9dd4 100644
--- a/packages/twenty-front/src/modules/object-metadata/utils/formatFieldMetadataItemAsFieldDefinition.ts
+++ b/packages/twenty-front/src/modules/object-metadata/utils/formatFieldMetadataItemAsFieldDefinition.ts
@@ -1,9 +1,9 @@
import { type ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { type FieldDefinition } from '@/object-record/record-field/types/FieldDefinition';
import { type FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
-import { getFieldButtonIcon } from '@/object-record/record-field/utils/getFieldButtonIcon';
import { type FieldMetadataItem } from '../types/FieldMetadataItem';
+import { getFieldButtonIcon } from '@/object-record/record-field/utils/getFieldButtonIcon';
export type FieldMetadataItemAsFieldDefinitionProps = {
field: FieldMetadataItem;
diff --git a/packages/twenty-server/eslint.config.js b/packages/twenty-server/eslint.config.mjs
similarity index 100%
rename from packages/twenty-server/eslint.config.js
rename to packages/twenty-server/eslint.config.mjs
diff --git a/packages/twenty-shared/eslint.config.js b/packages/twenty-shared/eslint.config.mjs
similarity index 100%
rename from packages/twenty-shared/eslint.config.js
rename to packages/twenty-shared/eslint.config.mjs
index 8f1daeb38ab..743bd6bb1dc 100644
--- a/packages/twenty-shared/eslint.config.js
+++ b/packages/twenty-shared/eslint.config.mjs
@@ -1,5 +1,3 @@
-import path from 'path';
-import { fileURLToPath } from 'url';
import js from '@eslint/js';
import nxPlugin from '@nx/eslint-plugin';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
@@ -11,6 +9,8 @@ import prettierPlugin from 'eslint-plugin-prettier';
import unicornPlugin from 'eslint-plugin-unicorn';
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
import jsoncParser from 'jsonc-eslint-parser';
+import path from 'path';
+import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
diff --git a/packages/twenty-ui/eslint.config.js b/packages/twenty-ui/eslint.config.mjs
similarity index 96%
rename from packages/twenty-ui/eslint.config.js
rename to packages/twenty-ui/eslint.config.mjs
index 3405d5d8b52..1a2b4105066 100644
--- a/packages/twenty-ui/eslint.config.js
+++ b/packages/twenty-ui/eslint.config.mjs
@@ -1,8 +1,8 @@
-import path from 'path';
-import { fileURLToPath } from 'url';
import typescriptParser from '@typescript-eslint/parser';
import jsoncParser from 'jsonc-eslint-parser';
-import reactConfig from '../../eslint.config.react.js';
+import path from 'path';
+import { fileURLToPath } from 'url';
+import reactConfig from '../../eslint.config.react.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
diff --git a/packages/twenty-website/eslint.config.js b/packages/twenty-website/eslint.config.mjs
similarity index 100%
rename from packages/twenty-website/eslint.config.js
rename to packages/twenty-website/eslint.config.mjs
diff --git a/tools/eslint-rules/project.json b/tools/eslint-rules/project.json
index f6ea2a585ec..d80a1d1db96 100644
--- a/tools/eslint-rules/project.json
+++ b/tools/eslint-rules/project.json
@@ -6,7 +6,7 @@
"targets": {
"lint": {
"options": {
- "eslintConfig": "{workspaceRoot}/eslint.config.js",
+ "eslintConfig": "{workspaceRoot}/eslint.config.mjs",
"lintFilePatterns": ["{projectRoot}/**/*.ts"]
},
"configurations": {