Browse Source

refactor: improves linting

e22m4u 3 days ago
parent
commit
183dea21b9
6 changed files with 29 additions and 15 deletions
  1. 0 4
      .mocharc.cjs
  2. 4 0
      .mocharc.json
  3. 1 0
      dist/cjs/index.cjs
  4. 7 2
      eslint.config.js
  5. 8 5
      package.json
  6. 9 4
      tsconfig.json

+ 0 - 4
.mocharc.cjs

@@ -1,4 +0,0 @@
-module.exports = {
-  extension: ['js'],
-  spec: 'src/**/*.spec.js',
-}

+ 4 - 0
.mocharc.json

@@ -0,0 +1,4 @@
+{
+  "extension": ["js"],
+  "spec": "src/**/*.spec.js"
+}

+ 1 - 0
dist/cjs/index.cjs

@@ -1,3 +1,4 @@
+"use strict";
 var __defProp = Object.defineProperty;
 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
 var __getOwnPropNames = Object.getOwnPropertyNames;

+ 7 - 2
eslint.config.js

@@ -2,6 +2,7 @@ import globals from 'globals';
 import eslintJs from '@eslint/js';
 import eslintJsdocPlugin from 'eslint-plugin-jsdoc';
 import eslintMochaPlugin from 'eslint-plugin-mocha';
+import eslintImportPlugin from 'eslint-plugin-import';
 import eslintPrettierConfig from 'eslint-config-prettier';
 import eslintChaiExpectPlugin from 'eslint-plugin-chai-expect';
 
@@ -16,16 +17,20 @@ export default [{
   plugins: {
     'jsdoc': eslintJsdocPlugin,
     'mocha': eslintMochaPlugin,
+    'import': eslintImportPlugin,
     'chai-expect': eslintChaiExpectPlugin,
   },
   rules: {
     ...eslintJs.configs.recommended.rules,
     ...eslintPrettierConfig.rules,
-    ...eslintJsdocPlugin.configs['flat/recommended-error'].rules,
+    ...eslintImportPlugin.flatConfigs.recommended.rules,
     ...eslintMochaPlugin.configs.recommended.rules,
     ...eslintChaiExpectPlugin.configs['recommended-flat'].rules,
-    'no-unused-vars': ['error', {'caughtErrors': 'none'}],
+    ...eslintJsdocPlugin.configs['flat/recommended-error'].rules,
+    'no-duplicate-imports': 'error',
+    'import/export': 0,
     'jsdoc/reject-any-type': 0,
+    'jsdoc/reject-function-type': 0,
     'jsdoc/require-param-description': 0,
     'jsdoc/require-returns-description': 0,
     'jsdoc/require-property-description': 0,

+ 8 - 5
package.json

@@ -9,10 +9,10 @@
     "trie",
     "router"
   ],
-  "homepage": "https://github.com/e22m4u/js-path-trie",
+  "homepage": "https://gitrepos.ru/e22m4u/js-path-trie",
   "repository": {
     "type": "git",
-    "url": "git+https://github.com/e22m4u/js-path-trie.git"
+    "url": "git+https://gitrepos.ru/e22m4u/js-path-trie.git"
   },
   "type": "module",
   "types": "./src/index.d.ts",
@@ -36,26 +36,29 @@
     "prepare": "husky"
   },
   "dependencies": {
-    "@e22m4u/js-debug": "~0.3.3",
-    "@e22m4u/js-format": "~0.2.1",
+    "@e22m4u/js-debug": "~0.4.1",
+    "@e22m4u/js-format": "~0.3.1",
     "path-to-regexp": "~8.3.0"
   },
   "devDependencies": {
     "@commitlint/cli": "~20.1.0",
     "@commitlint/config-conventional": "~20.0.0",
     "@eslint/js": "~9.39.1",
+    "@types/chai": "~5.2.3",
+    "@types/mocha": "~10.0.10",
     "c8": "~10.1.3",
     "chai": "~6.2.1",
     "esbuild": "~0.27.0",
     "eslint": "~9.39.1",
     "eslint-config-prettier": "~10.1.8",
     "eslint-plugin-chai-expect": "~3.1.0",
+    "eslint-plugin-import": "~2.32.0",
     "eslint-plugin-jsdoc": "~61.4.1",
     "eslint-plugin-mocha": "~11.2.0",
     "globals": "~16.5.0",
     "husky": "~9.1.7",
     "mocha": "~11.7.5",
-    "prettier": "~3.6.2",
+    "prettier": "~3.7.4",
     "rimraf": "~6.1.2",
     "typescript": "~5.9.3"
   }

+ 9 - 4
tsconfig.json

@@ -1,9 +1,14 @@
 {
   "compilerOptions": {
-    "rootDir": "src",
-    "noEmit": true,
+    "strict": true,
     "target": "es2022",
     "module": "NodeNext",
-    "moduleResolution": "NodeNext"
-  }
+    "moduleResolution": "NodeNext",
+    "noEmit": true,
+    "allowJs": true
+  },
+  "include": [
+    "./src/**/*.ts",
+    "./src/**/*.js"
+  ]
 }