Browse Source

refactor: removes type definitions

e22m4u 4 days ago
parent
commit
ecb291216f
5 changed files with 15 additions and 42 deletions
  1. 6 2
      eslint.config.js
  2. 0 2
      jsconfig.json
  3. 9 11
      package.json
  4. 0 1
      src/index.d.ts
  5. 0 26
      src/path-trie.d.ts

+ 6 - 2
eslint.config.js

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

+ 0 - 2
tsconfig.json → jsconfig.json

@@ -1,7 +1,5 @@
 {
 {
   "compilerOptions": {
   "compilerOptions": {
-    "rootDir": "src",
-    "noEmit": true,
     "target": "es2022",
     "target": "es2022",
     "module": "NodeNext",
     "module": "NodeNext",
     "moduleResolution": "NodeNext"
     "moduleResolution": "NodeNext"

+ 9 - 11
package.json

@@ -9,17 +9,15 @@
     "trie",
     "trie",
     "router"
     "router"
   ],
   ],
-  "homepage": "https://github.com/e22m4u/js-path-trie",
+  "homepage": "https://gitrepos.ru/e22m4u/js-path-trie",
   "repository": {
   "repository": {
     "type": "git",
     "type": "git",
-    "url": "git+https://github.com/e22m4u/js-path-trie.git"
+    "url": "git+https://gitrepos.ru/e22m4u/js-path-trie.git"
   },
   },
   "type": "module",
   "type": "module",
-  "types": "./src/index.d.ts",
   "module": "./src/index.js",
   "module": "./src/index.js",
   "main": "./dist/cjs/index.cjs",
   "main": "./dist/cjs/index.cjs",
   "exports": {
   "exports": {
-    "types": "./src/index.d.ts",
     "import": "./src/index.js",
     "import": "./src/index.js",
     "require": "./dist/cjs/index.cjs"
     "require": "./dist/cjs/index.cjs"
   },
   },
@@ -27,8 +25,8 @@
     "node": ">=16"
     "node": ">=16"
   },
   },
   "scripts": {
   "scripts": {
-    "lint": "tsc && eslint ./src",
-    "lint:fix": "tsc && eslint ./src --fix",
+    "lint": "eslint ./src",
+    "lint:fix": "eslint ./src --fix",
     "format": "prettier --write \"./src/**/*.js\"",
     "format": "prettier --write \"./src/**/*.js\"",
     "test": "npm run lint && c8 --reporter=text-summary mocha",
     "test": "npm run lint && c8 --reporter=text-summary mocha",
     "test:coverage": "npm run lint && c8 --reporter=text mocha",
     "test:coverage": "npm run lint && c8 --reporter=text mocha",
@@ -36,8 +34,8 @@
     "prepare": "husky"
     "prepare": "husky"
   },
   },
   "dependencies": {
   "dependencies": {
-    "@e22m4u/js-debug": "~0.3.3",
-    "@e22m4u/js-format": "~0.2.1",
+    "@e22m4u/js-debug": "~0.4.0",
+    "@e22m4u/js-format": "~0.3.0",
     "path-to-regexp": "~8.3.0"
     "path-to-regexp": "~8.3.0"
   },
   },
   "devDependencies": {
   "devDependencies": {
@@ -50,13 +48,13 @@
     "eslint": "~9.39.1",
     "eslint": "~9.39.1",
     "eslint-config-prettier": "~10.1.8",
     "eslint-config-prettier": "~10.1.8",
     "eslint-plugin-chai-expect": "~3.1.0",
     "eslint-plugin-chai-expect": "~3.1.0",
+    "eslint-plugin-import": "^2.32.0",
     "eslint-plugin-jsdoc": "~61.4.1",
     "eslint-plugin-jsdoc": "~61.4.1",
     "eslint-plugin-mocha": "~11.2.0",
     "eslint-plugin-mocha": "~11.2.0",
     "globals": "~16.5.0",
     "globals": "~16.5.0",
     "husky": "~9.1.7",
     "husky": "~9.1.7",
     "mocha": "~11.7.5",
     "mocha": "~11.7.5",
-    "prettier": "~3.6.2",
-    "rimraf": "~6.1.2",
-    "typescript": "~5.9.3"
+    "prettier": "~3.7.3",
+    "rimraf": "~6.1.2"
   }
   }
 }
 }

+ 0 - 1
src/index.d.ts

@@ -1 +0,0 @@
-export * from './path-trie.js';

+ 0 - 26
src/path-trie.d.ts

@@ -1,26 +0,0 @@
-/**
- * Resolved value.
- */
-export type ResolvedValue<T = unknown> = {
-  value: T;
-  params: {[name: string]: unknown};
-}
-
-/**
- * Path trie.
- */
-export declare class PathTrie {
-  /**
-   * Add value.
-   *
-   * @param pathTemplate
-   * @param value
-   */
-  add<T>(pathTemplate: string, value: T): this;
-
-  /**
-   * Match value.
-   * @param path
-   */
-  match<T = unknown>(path: string): ResolvedValue<T> | undefined;
-}