Browse Source

chore: upgrades dependencies

e22m4u 1 year ago
parent
commit
ee07a212a6

+ 0 - 1
.eslintignore

@@ -1 +0,0 @@
-*.d.ts

+ 0 - 51
.eslintrc.cjs

@@ -1,51 +0,0 @@
-module.exports = {
-  env: {
-    es2021: true,
-    node: true
-  },
-  parserOptions: {
-    sourceType: 'module',
-    ecmaVersion: 13,
-  },
-  overrides: [
-    {
-      files: ['**/*.js'],
-      plugins: [
-        'mocha',
-        'jsdoc',
-        'chai-expect',
-      ],
-      extends: [
-        'prettier',
-        'plugin:jsdoc/recommended',
-        'plugin:mocha/recommended',
-        'plugin:chai-expect/recommended',
-        'plugin:jsdoc/recommended-error',
-      ],
-      rules: {
-        'jsdoc/require-param-description': 0,
-        'jsdoc/require-returns-description': 0,
-        'jsdoc/require-property-description': 0,
-        'jsdoc/tag-lines': ['error', 'any', {startLines: 1}],
-      },
-    },
-    {
-      files: ['**/*.ts'],
-      plugins: [
-        'mocha',
-        'chai-expect',
-        '@typescript-eslint',
-      ],
-      extends: [
-        'prettier',
-        'eslint:recommended',
-        'plugin:@typescript-eslint/recommended',
-      ],
-      rules: {
-        '@typescript-eslint/no-namespace': 0,
-        '@typescript-eslint/no-var-requires': 0,
-        '@typescript-eslint/no-unnecessary-type-constraint': 0,
-      },
-    }
-  ]
-}

+ 66 - 0
eslint.config.js

@@ -0,0 +1,66 @@
+import globals from 'globals';
+import eslintJs from '@eslint/js';
+import eslintTypescript from 'typescript-eslint';
+import eslintJsdocPlugin from 'eslint-plugin-jsdoc';
+import eslintMochaPlugin from 'eslint-plugin-mocha';
+import eslintPrettierConfig from 'eslint-config-prettier';
+import eslintChaiExpectPlugin from 'eslint-plugin-chai-expect';
+
+export default [
+  {
+    files: ['src/**/*.js'],
+    languageOptions: {
+      globals: {
+        ...globals.node,
+        ...globals.es2021,
+        ...globals.mocha,
+      },
+    },
+    plugins: {
+      'jsdoc': eslintJsdocPlugin,
+      'mocha': eslintMochaPlugin,
+      'chai-expect': eslintChaiExpectPlugin,
+    },
+    rules: {
+      ...eslintJs.configs.recommended.rules,
+      ...eslintPrettierConfig.rules,
+      ...eslintMochaPlugin.configs.flat.recommended.rules,
+      ...eslintChaiExpectPlugin.configs['recommended-flat'].rules,
+      ...eslintJsdocPlugin.configs['flat/recommended-error'].rules,
+      'no-unused-vars': ['error', {'caughtErrors': 'none'}],
+      'jsdoc/require-param-description': 0,
+      'jsdoc/require-returns-description': 0,
+      'jsdoc/require-property-description': 0,
+      'jsdoc/tag-lines': ['error', 'any', {startLines: 1}],
+    },
+  },
+  {
+    files: ['src/**/*.ts'],
+    ignores: ['src/**/*.d.ts'],
+    languageOptions: {
+      globals: {
+        ...globals.node,
+        ...globals.es2021,
+        ...globals.mocha,
+      },
+      parser: eslintTypescript.parser,
+      parserOptions: {
+        projectService: true,
+        tsconfigRootDir: import.meta.dirname,
+      },
+    },
+    plugins: {
+      '@typescript-eslint': eslintTypescript.plugin,
+      'mocha': eslintMochaPlugin,
+      'chai-expect': eslintChaiExpectPlugin,
+    },
+    rules: {
+      ...eslintJs.configs.recommended.rules,
+      ...eslintPrettierConfig.rules,
+      ...eslintTypescript.configs.recommended.rules,
+      '@typescript-eslint/no-namespace': 0,
+      '@typescript-eslint/no-var-requires': 0,
+      '@typescript-eslint/no-unnecessary-type-constraint': 0,
+    },
+  },
+];

+ 11 - 12
package.json

@@ -31,32 +31,31 @@
   "license": "MIT",
   "license": "MIT",
   "homepage": "https://github.com/e22m4u/js-repository",
   "homepage": "https://github.com/e22m4u/js-repository",
   "peerDependencies": {
   "peerDependencies": {
-    "@e22m4u/js-service": "0.0.x",
-    "@e22m4u/js-format": "0.0.x"
+    "@e22m4u/js-format": "0.0.x",
+    "@e22m4u/js-service": "0.0.x"
   },
   },
   "devDependencies": {
   "devDependencies": {
-    "@commitlint/cli": "~19.3.0",
+    "@commitlint/cli": "~19.4.0",
     "@commitlint/config-conventional": "~19.2.2",
     "@commitlint/config-conventional": "~19.2.2",
-    "@types/chai": "~4.3.16",
+    "@types/chai": "~4.3.17",
     "@types/chai-as-promised": "~7.1.8",
     "@types/chai-as-promised": "~7.1.8",
     "@types/chai-spies": "~1.0.6",
     "@types/chai-spies": "~1.0.6",
     "@types/mocha": "~10.0.7",
     "@types/mocha": "~10.0.7",
-    "@typescript-eslint/eslint-plugin": "~7.17.0",
-    "@typescript-eslint/parser": "~7.17.0",
     "c8": "~10.1.2",
     "c8": "~10.1.2",
     "chai": "~5.1.1",
     "chai": "~5.1.1",
     "chai-as-promised": "~8.0.0",
     "chai-as-promised": "~8.0.0",
     "chai-spies": "~1.1.0",
     "chai-spies": "~1.1.0",
     "chai-subset": "~1.6.0",
     "chai-subset": "~1.6.0",
-    "eslint": "~8.57.0",
+    "eslint": "~9.9.0",
     "eslint-config-prettier": "~9.1.0",
     "eslint-config-prettier": "~9.1.0",
     "eslint-plugin-chai-expect": "~3.1.0",
     "eslint-plugin-chai-expect": "~3.1.0",
-    "eslint-plugin-jsdoc": "~48.8.3",
-    "eslint-plugin-mocha": "~10.4.3",
-    "husky": "~9.1.2",
-    "mocha": "~10.7.0",
+    "eslint-plugin-jsdoc": "~50.2.2",
+    "eslint-plugin-mocha": "~10.5.0",
+    "husky": "~9.1.4",
+    "mocha": "~10.7.3",
     "prettier": "~3.3.3",
     "prettier": "~3.3.3",
     "ts-node": "~10.9.2",
     "ts-node": "~10.9.2",
-    "typescript": "~5.5.4"
+    "typescript": "~5.5.4",
+    "typescript-eslint": "~8.2.0"
   }
   }
 }
 }

+ 1 - 0
src/adapter/builtin/memory-adapter.js

@@ -164,6 +164,7 @@ export class MemoryAdapter extends Adapter {
    * @param {object|undefined} filter
    * @param {object|undefined} filter
    * @returns {Promise<object>}
    * @returns {Promise<object>}
    */
    */
+  // eslint-disable-next-line no-unused-vars
   async replaceOrCreate(modelName, modelData, filter = undefined) {
   async replaceOrCreate(modelName, modelData, filter = undefined) {
     const pkPropName =
     const pkPropName =
       this.getService(ModelDefinitionUtils).getPrimaryKeyAsPropertyName(
       this.getService(ModelDefinitionUtils).getPrimaryKeyAsPropertyName(

+ 3 - 0
src/utils/get-decorator-target-type.spec.js

@@ -56,6 +56,7 @@ describe('getDecoratorTargetType', function () {
 
 
   it('returns CONSTRUCTOR_PARAMETER', function () {
   it('returns CONSTRUCTOR_PARAMETER', function () {
     class Target {
     class Target {
+      // eslint-disable-next-line no-unused-vars
       constructor(param) {}
       constructor(param) {}
     }
     }
     validate(DTT.CONSTRUCTOR_PARAMETER)(Target, undefined, 0);
     validate(DTT.CONSTRUCTOR_PARAMETER)(Target, undefined, 0);
@@ -63,6 +64,7 @@ describe('getDecoratorTargetType', function () {
 
 
   it('returns STATIC_METHOD_PARAMETER', function () {
   it('returns STATIC_METHOD_PARAMETER', function () {
     class Target {
     class Target {
+      // eslint-disable-next-line no-unused-vars
       static method(param) {}
       static method(param) {}
     }
     }
     validate(DTT.STATIC_METHOD_PARAMETER)(Target, 'method', 0);
     validate(DTT.STATIC_METHOD_PARAMETER)(Target, 'method', 0);
@@ -70,6 +72,7 @@ describe('getDecoratorTargetType', function () {
 
 
   it('returns INSTANCE_METHOD_PARAMETER', function () {
   it('returns INSTANCE_METHOD_PARAMETER', function () {
     class Target {
     class Target {
+      // eslint-disable-next-line no-unused-vars
       method(param) {}
       method(param) {}
     }
     }
     validate(DTT.INSTANCE_METHOD_PARAMETER)(Target.prototype, 'method', 0);
     validate(DTT.INSTANCE_METHOD_PARAMETER)(Target.prototype, 'method', 0);

+ 1 - 1
src/utils/is-deep-equal.js

@@ -58,7 +58,7 @@ export function isDeepEqual(firstValue, secondValue) {
     // the property value.
     // the property value.
     const propertyNamesA = [...keysA, ...symbolsA];
     const propertyNamesA = [...keysA, ...symbolsA];
     for (const propertyNameA of propertyNamesA) {
     for (const propertyNameA of propertyNamesA) {
-      if (!b.hasOwnProperty(propertyNameA)) return false;
+      if (!Object.prototype.hasOwnProperty.call(b, propertyNameA)) return false;
       const propertyValueA = a[propertyNameA];
       const propertyValueA = a[propertyNameA];
       const propertyValueB = b[propertyNameA];
       const propertyValueB = b[propertyNameA];
       if (!compare(propertyValueA, propertyValueB)) return false;
       if (!compare(propertyValueA, propertyValueB)) return false;