From 05a7f1e632c1673e8a33f484342360a896cff04a Mon Sep 17 00:00:00 2001 From: andrew rumble Date: Tue, 1 Oct 2024 15:57:11 +0100 Subject: [PATCH] Add mjs support to eslint GitOrigin-RevId: d2db7eb14e3d68a7dc95b24c98cee0d41ccd7e74 --- services/web/.eslintrc.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/services/web/.eslintrc.js b/services/web/.eslintrc.js index 54e12ba70c..8c2bac95ba 100644 --- a/services/web/.eslintrc.js +++ b/services/web/.eslintrc.js @@ -45,10 +45,10 @@ module.exports = { { // Node files: [ - '**/app/src/**/*.js', - 'app.js', + '**/app/src/**/*.{js,mjs}', + 'app.{js,mjs}', 'i18next-scanner.config.js', - 'scripts/**/*.js', + 'scripts/**/*.{js,mjs}', 'webpack.config*.js', ], env: { @@ -89,9 +89,24 @@ module.exports = { '@typescript-eslint/no-unused-expressions': 'off', }, }, + { + // ES specific rules + files: ['**/app/src/**/*.mjs'], + rules: { + 'import/no-unresolved': 'error', + 'import/extensions': [ + 'error', + 'ignorePackages', + { + js: 'always', + mjs: 'always', + }, + ], + }, + }, { // Backend specific rules - files: ['**/app/src/**/*.js', 'app.js'], + files: ['**/app/src/**/*.{js,mjs}', 'app.{js,mjs}'], parserOptions: { tsconfigRootDir: __dirname, project: './tsconfig.backend.json', @@ -409,8 +424,8 @@ module.exports = { // Backend: Use @overleaf/logger // Docs: https://manual.dev-overleaf.com/development/code/logging/#structured-logging '**/app/**/*.{js,cjs,mjs}', - 'app.js', - 'modules/*/*.js', + 'app.{js,mjs}', + 'modules/*/*.{js,mjs}', // Frontend: Prefer debugConsole over bare console // Docs: https://manual.dev-overleaf.com/development/code/logging/#frontend '**/frontend/**/*.{js,jsx,ts,tsx}',