Browse Source

update eslint settings to check .mjs and .mts

Yuki Takei 10 months ago
parent
commit
f292a932c8
6 changed files with 23 additions and 12 deletions
  1. 0 1
      .eslintignore
  2. 7 1
      .eslintrc.js
  3. 0 6
      apps/app/.eslintignore
  4. 14 2
      apps/app/.eslintrc.js
  5. 1 1
      apps/app/package.json
  6. 1 1
      apps/app/vitest.workspace.mts

+ 0 - 1
.eslintignore

@@ -1 +0,0 @@
-node_modules/**

+ 7 - 1
.eslintrc.js

@@ -1,3 +1,6 @@
+/**
+ * @type {import('eslint').Linter.Config}
+ */
 module.exports = {
   root: true, // https://eslint.org/docs/user-guide/configuring/configuration-files#cascading-and-hierarchy
   extends: [
@@ -7,6 +10,9 @@ module.exports = {
   plugins: [
     'regex',
   ],
+  ignorePatterns: [
+    'node_modules/**',
+  ],
   rules: {
     'import/prefer-default-export': 'off',
     'import/order': [
@@ -73,7 +79,7 @@ module.exports = {
   overrides: [
     {
       // enable the rule specifically for TypeScript files
-      files: ['*.ts', '*.tsx'],
+      files: ['*.ts', '*.mts', '*.tsx'],
       rules: {
         '@typescript-eslint/explicit-module-boundary-types': ['error'],
       },

+ 0 - 6
apps/app/.eslintignore

@@ -1,6 +0,0 @@
-/dist/**
-/transpiled/**
-/public/**
-/src/linter-checker/**
-/tmp/**
-/next-env.d.ts

+ 14 - 2
apps/app/.eslintrc.js

@@ -1,3 +1,6 @@
+/**
+ * @type {import('eslint').Linter.Config}
+ */
 module.exports = {
   extends: [
     'next/core-web-vitals',
@@ -5,6 +8,15 @@ module.exports = {
   ],
   plugins: [
   ],
+  ignorePatterns: [
+    'dist/**',
+    '**/dist/**',
+    'transpiled/**',
+    'public/**',
+    'src/linter-checker/**',
+    'tmp/**',
+    'next-env.d.ts',
+  ],
   settings: {
     // resolve path aliases by eslint-import-resolver-typescript
     'import/resolver': {
@@ -25,7 +37,7 @@ module.exports = {
   overrides: [
     {
       // enable the rule specifically for JavaScript files
-      files: ['*.js', '*.jsx'],
+      files: ['*.js', '*.mjs', '*.jsx'],
       rules: {
         // set 'warn' temporarily -- 2023.08.14 Yuki Takei
         'react/prop-types': 'warn',
@@ -35,7 +47,7 @@ module.exports = {
     },
     {
       // enable the rule specifically for TypeScript files
-      files: ['*.ts', '*.tsx'],
+      files: ['*.ts', '*.mts', '*.tsx'],
       rules: {
         'no-unused-vars': 'off',
         // set 'warn' temporarily -- 2023.08.14 Yuki Takei

+ 1 - 1
apps/app/package.json

@@ -27,7 +27,7 @@
     "//// for CI": "",
     "launch-dev:ci": "cross-env NODE_ENV=development pnpm run dev:migrate && pnpm run ts-node src/server/app.ts --ci",
     "lint:typecheck": "vue-tsc --noEmit",
-    "lint:eslint": "eslint --quiet \"**/*.{js,jsx,ts,tsx}\"",
+    "lint:eslint": "eslint --quiet \"**/*.{js,mjs,jsx,ts,mts,tsx}\"",
     "lint:styles": "stylelint \"src/**/*.scss\"",
     "lint:swagger2openapi:apiv3": "node node_modules/swagger2openapi/oas-validate tmp/openapi-spec-apiv3.json",
     "lint:swagger2openapi:apiv1": "node node_modules/swagger2openapi/oas-validate tmp/openapi-spec-apiv1.json",

+ 1 - 1
apps/app/vitest.workspace.mts

@@ -15,7 +15,7 @@ const configShared = defineConfig({
       'test/**',
       'test-with-vite/**',
       'playwright/**',
-    ]
+    ],
   },
 });