Migrate eslint to mjs (#13850)

Migrating eslint.config.js to eslint.config.mjs to remove ES error while
running linter
This commit is contained in:
Charles Bochet
2025-08-12 13:12:03 +02:00
committed by GitHub
parent 828be15405
commit be8af1eb29
11 changed files with 39 additions and 95 deletions
+28 -85
View File
@@ -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"
}
}
@@ -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);
@@ -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'],
@@ -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;
@@ -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);
@@ -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);
+1 -1
View File
@@ -6,7 +6,7 @@
"targets": {
"lint": {
"options": {
"eslintConfig": "{workspaceRoot}/eslint.config.js",
"eslintConfig": "{workspaceRoot}/eslint.config.mjs",
"lintFilePatterns": ["{projectRoot}/**/*.ts"]
},
"configurations": {