From 7aac33be2a2db5ab48c75f906c3c6f79c91b36bf Mon Sep 17 00:00:00 2001 From: Frank Hinek Date: Fri, 9 Jun 2023 14:44:19 -0400 Subject: [PATCH] Fix eslint NPM scripts and migrate to root .eslintrc config Signed-off-by: Frank Hinek --- .eslintignore | 3 -- .../.eslintrc.cjs => .eslintrc.cjs | 5 ++ packages/crypto/.eslintrc.cjs | 50 ------------------- packages/crypto/package.json | 4 +- packages/dids/.eslintrc.cjs | 50 ------------------- packages/dids/package.json | 4 +- packages/web5-agent/.eslintrc.cjs | 50 ------------------- packages/web5-agent/package.json | 4 +- packages/web5-proxy-agent/package.json | 4 +- packages/web5-user-agent/.eslintrc.cjs | 50 ------------------- packages/web5-user-agent/.eslintrcignore | 1 - packages/web5-user-agent/package.json | 4 +- packages/web5/.eslintrc.cjs | 50 ------------------- packages/web5/package.json | 4 +- packages/web5/src/did-resolution-cache.ts | 2 +- web5-js.code-workspace | 8 ++- 16 files changed, 25 insertions(+), 268 deletions(-) delete mode 100644 .eslintignore rename packages/web5-proxy-agent/.eslintrc.cjs => .eslintrc.cjs (94%) delete mode 100644 packages/crypto/.eslintrc.cjs delete mode 100644 packages/dids/.eslintrc.cjs delete mode 100644 packages/web5-agent/.eslintrc.cjs delete mode 100644 packages/web5-user-agent/.eslintrc.cjs delete mode 100644 packages/web5-user-agent/.eslintrcignore delete mode 100644 packages/web5/.eslintrc.cjs diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 727081205..000000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -test-site -dist -test.mjs \ No newline at end of file diff --git a/packages/web5-proxy-agent/.eslintrc.cjs b/.eslintrc.cjs similarity index 94% rename from packages/web5-proxy-agent/.eslintrc.cjs rename to .eslintrc.cjs index 5372b558f..875c70d77 100644 --- a/packages/web5-proxy-agent/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,5 +1,6 @@ /** @type {import('eslint').ESLint.ConfigData} */ module.exports = { + root : true, extends : ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], parser : '@typescript-eslint/parser', parserOptions : { @@ -12,6 +13,10 @@ module.exports = { es2022 : true, browser : true }, + 'ignorePatterns': [ + 'dist', + '__tests__' + ], rules: { 'key-spacing': [ 'error', diff --git a/packages/crypto/.eslintrc.cjs b/packages/crypto/.eslintrc.cjs deleted file mode 100644 index 5372b558f..000000000 --- a/packages/crypto/.eslintrc.cjs +++ /dev/null @@ -1,50 +0,0 @@ -/** @type {import('eslint').ESLint.ConfigData} */ -module.exports = { - extends : ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - parser : '@typescript-eslint/parser', - parserOptions : { - ecmaVersion : 2022, - sourceType : 'module' - }, - plugins : ['@typescript-eslint'], - env : { - node : true, - es2022 : true, - browser : true - }, - rules: { - 'key-spacing': [ - 'error', - { - 'align': { - 'afterColon' : true, - 'beforeColon' : true, - 'on' : 'colon' - } - } - ], - 'quotes': [ - 'error', - 'single', - { 'allowTemplateLiterals': true } - ], - 'semi' : ['error', 'always'], - 'indent' : ['error', 2], - 'no-unused-vars' : 'off', - 'prefer-const' : 'off', - '@typescript-eslint/no-unused-vars' : [ - 'error', - { - 'vars' : 'all', - 'args' : 'after-used', - 'ignoreRestSiblings' : true, - 'argsIgnorePattern' : '^_', - 'varsIgnorePattern' : '^_' - } - ], - '@typescript-eslint/no-explicit-any' : 'off', - 'no-trailing-spaces' : ['error'], - '@typescript-eslint/no-non-null-assertion' : 'off', - '@typescript-eslint/ban-ts-comment' : 'off' - } -}; \ No newline at end of file diff --git a/packages/crypto/package.json b/packages/crypto/package.json index bee507cac..a5cb3378c 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -8,8 +8,8 @@ "types": "./dist/types/main.d.ts", "scripts": { "build": "rimraf dist && node build/bundles.js && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json && tsc", - "lint": "eslint . --ext .js --max-warnings 0", - "lint:fix": "eslint . --ext .js --fix", + "lint": "eslint . --ext .ts --max-warnings 0", + "lint:fix": "eslint . --ext .ts --fix", "test:node": "rimraf __tests__ && tsc -p tsconfig.test.json && c8 mocha", "test:browser": "karma start karma.conf.cjs" }, diff --git a/packages/dids/.eslintrc.cjs b/packages/dids/.eslintrc.cjs deleted file mode 100644 index 5372b558f..000000000 --- a/packages/dids/.eslintrc.cjs +++ /dev/null @@ -1,50 +0,0 @@ -/** @type {import('eslint').ESLint.ConfigData} */ -module.exports = { - extends : ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - parser : '@typescript-eslint/parser', - parserOptions : { - ecmaVersion : 2022, - sourceType : 'module' - }, - plugins : ['@typescript-eslint'], - env : { - node : true, - es2022 : true, - browser : true - }, - rules: { - 'key-spacing': [ - 'error', - { - 'align': { - 'afterColon' : true, - 'beforeColon' : true, - 'on' : 'colon' - } - } - ], - 'quotes': [ - 'error', - 'single', - { 'allowTemplateLiterals': true } - ], - 'semi' : ['error', 'always'], - 'indent' : ['error', 2], - 'no-unused-vars' : 'off', - 'prefer-const' : 'off', - '@typescript-eslint/no-unused-vars' : [ - 'error', - { - 'vars' : 'all', - 'args' : 'after-used', - 'ignoreRestSiblings' : true, - 'argsIgnorePattern' : '^_', - 'varsIgnorePattern' : '^_' - } - ], - '@typescript-eslint/no-explicit-any' : 'off', - 'no-trailing-spaces' : ['error'], - '@typescript-eslint/no-non-null-assertion' : 'off', - '@typescript-eslint/ban-ts-comment' : 'off' - } -}; \ No newline at end of file diff --git a/packages/dids/package.json b/packages/dids/package.json index 2e191617d..5567e2a74 100644 --- a/packages/dids/package.json +++ b/packages/dids/package.json @@ -8,8 +8,8 @@ "types": "./dist/types/main.d.ts", "scripts": { "build": "rimraf dist && node build/bundles.js && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json && tsc", - "lint": "eslint . --ext .js --max-warnings 0", - "lint:fix": "eslint . --ext .js --fix", + "lint": "eslint . --ext .ts --max-warnings 0", + "lint:fix": "eslint . --ext .ts --fix", "test:node": "rimraf __tests__ && tsc -p tsconfig.test.json && c8 mocha", "test:browser": "karma start karma.conf.cjs" }, diff --git a/packages/web5-agent/.eslintrc.cjs b/packages/web5-agent/.eslintrc.cjs deleted file mode 100644 index 5372b558f..000000000 --- a/packages/web5-agent/.eslintrc.cjs +++ /dev/null @@ -1,50 +0,0 @@ -/** @type {import('eslint').ESLint.ConfigData} */ -module.exports = { - extends : ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - parser : '@typescript-eslint/parser', - parserOptions : { - ecmaVersion : 2022, - sourceType : 'module' - }, - plugins : ['@typescript-eslint'], - env : { - node : true, - es2022 : true, - browser : true - }, - rules: { - 'key-spacing': [ - 'error', - { - 'align': { - 'afterColon' : true, - 'beforeColon' : true, - 'on' : 'colon' - } - } - ], - 'quotes': [ - 'error', - 'single', - { 'allowTemplateLiterals': true } - ], - 'semi' : ['error', 'always'], - 'indent' : ['error', 2], - 'no-unused-vars' : 'off', - 'prefer-const' : 'off', - '@typescript-eslint/no-unused-vars' : [ - 'error', - { - 'vars' : 'all', - 'args' : 'after-used', - 'ignoreRestSiblings' : true, - 'argsIgnorePattern' : '^_', - 'varsIgnorePattern' : '^_' - } - ], - '@typescript-eslint/no-explicit-any' : 'off', - 'no-trailing-spaces' : ['error'], - '@typescript-eslint/no-non-null-assertion' : 'off', - '@typescript-eslint/ban-ts-comment' : 'off' - } -}; \ No newline at end of file diff --git a/packages/web5-agent/package.json b/packages/web5-agent/package.json index 992c6f0f2..90dca8e7f 100644 --- a/packages/web5-agent/package.json +++ b/packages/web5-agent/package.json @@ -8,8 +8,8 @@ "types": "./dist/types/main.d.ts", "scripts": { "build": "rimraf dist && node build/bundles.js && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json && tsc", - "lint": "eslint . --ext .js --max-warnings 0", - "lint:fix": "eslint . --ext .js --fix", + "lint": "eslint . --ext .ts --max-warnings 0", + "lint:fix": "eslint . --ext .ts --fix", "test:node": "rimraf __tests__ && tsc -p tsconfig.test.json && c8 mocha", "test:browser": "karma start karma.conf.cjs" }, diff --git a/packages/web5-proxy-agent/package.json b/packages/web5-proxy-agent/package.json index c7c29bda6..919845953 100644 --- a/packages/web5-proxy-agent/package.json +++ b/packages/web5-proxy-agent/package.json @@ -8,8 +8,8 @@ "types": "./dist/types/main.d.ts", "scripts": { "build": "rimraf dist && node build/bundles.js && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json && tsc", - "lint": "eslint . --ext .js --max-warnings 0", - "lint:fix": "eslint . --ext .js --fix", + "lint": "eslint . --ext .ts --max-warnings 0", + "lint:fix": "eslint . --ext .ts --fix", "test:node": "rimraf __tests__ && tsc -p tsconfig.test.json && c8 mocha", "test:browser": "karma start karma.conf.cjs" }, diff --git a/packages/web5-user-agent/.eslintrc.cjs b/packages/web5-user-agent/.eslintrc.cjs deleted file mode 100644 index 5372b558f..000000000 --- a/packages/web5-user-agent/.eslintrc.cjs +++ /dev/null @@ -1,50 +0,0 @@ -/** @type {import('eslint').ESLint.ConfigData} */ -module.exports = { - extends : ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - parser : '@typescript-eslint/parser', - parserOptions : { - ecmaVersion : 2022, - sourceType : 'module' - }, - plugins : ['@typescript-eslint'], - env : { - node : true, - es2022 : true, - browser : true - }, - rules: { - 'key-spacing': [ - 'error', - { - 'align': { - 'afterColon' : true, - 'beforeColon' : true, - 'on' : 'colon' - } - } - ], - 'quotes': [ - 'error', - 'single', - { 'allowTemplateLiterals': true } - ], - 'semi' : ['error', 'always'], - 'indent' : ['error', 2], - 'no-unused-vars' : 'off', - 'prefer-const' : 'off', - '@typescript-eslint/no-unused-vars' : [ - 'error', - { - 'vars' : 'all', - 'args' : 'after-used', - 'ignoreRestSiblings' : true, - 'argsIgnorePattern' : '^_', - 'varsIgnorePattern' : '^_' - } - ], - '@typescript-eslint/no-explicit-any' : 'off', - 'no-trailing-spaces' : ['error'], - '@typescript-eslint/no-non-null-assertion' : 'off', - '@typescript-eslint/ban-ts-comment' : 'off' - } -}; \ No newline at end of file diff --git a/packages/web5-user-agent/.eslintrcignore b/packages/web5-user-agent/.eslintrcignore deleted file mode 100644 index 737a4e811..000000000 --- a/packages/web5-user-agent/.eslintrcignore +++ /dev/null @@ -1 +0,0 @@ -__tests__ \ No newline at end of file diff --git a/packages/web5-user-agent/package.json b/packages/web5-user-agent/package.json index afa9c8a0d..55f646a3b 100644 --- a/packages/web5-user-agent/package.json +++ b/packages/web5-user-agent/package.json @@ -8,8 +8,8 @@ "types": "./dist/types/main.d.ts", "scripts": { "build": "rimraf dist && node build/bundles.js && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json && tsc", - "lint": "eslint . --ext .js --max-warnings 0", - "lint:fix": "eslint . --ext .js --fix", + "lint": "eslint . --ext .ts --max-warnings 0", + "lint:fix": "eslint . --ext .ts --fix", "test:node": "rimraf __tests__ && tsc -p tsconfig.test.json && c8 mocha", "test:browser": "karma start karma.conf.cjs" }, diff --git a/packages/web5/.eslintrc.cjs b/packages/web5/.eslintrc.cjs deleted file mode 100644 index 5372b558f..000000000 --- a/packages/web5/.eslintrc.cjs +++ /dev/null @@ -1,50 +0,0 @@ -/** @type {import('eslint').ESLint.ConfigData} */ -module.exports = { - extends : ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - parser : '@typescript-eslint/parser', - parserOptions : { - ecmaVersion : 2022, - sourceType : 'module' - }, - plugins : ['@typescript-eslint'], - env : { - node : true, - es2022 : true, - browser : true - }, - rules: { - 'key-spacing': [ - 'error', - { - 'align': { - 'afterColon' : true, - 'beforeColon' : true, - 'on' : 'colon' - } - } - ], - 'quotes': [ - 'error', - 'single', - { 'allowTemplateLiterals': true } - ], - 'semi' : ['error', 'always'], - 'indent' : ['error', 2], - 'no-unused-vars' : 'off', - 'prefer-const' : 'off', - '@typescript-eslint/no-unused-vars' : [ - 'error', - { - 'vars' : 'all', - 'args' : 'after-used', - 'ignoreRestSiblings' : true, - 'argsIgnorePattern' : '^_', - 'varsIgnorePattern' : '^_' - } - ], - '@typescript-eslint/no-explicit-any' : 'off', - 'no-trailing-spaces' : ['error'], - '@typescript-eslint/no-non-null-assertion' : 'off', - '@typescript-eslint/ban-ts-comment' : 'off' - } -}; \ No newline at end of file diff --git a/packages/web5/package.json b/packages/web5/package.json index 6d4e87b81..a3ae97ce9 100644 --- a/packages/web5/package.json +++ b/packages/web5/package.json @@ -8,8 +8,8 @@ "types": "./dist/types/main.d.ts", "scripts": { "build": "rimraf dist && node build/bundles.js && echo '{\"type\": \"commonjs\"}' > ./dist/cjs/package.json && tsc", - "lint": "eslint . --ext .js --max-warnings 0", - "lint:fix": "eslint . --ext .js --fix", + "lint": "eslint . --ext .ts --max-warnings 0", + "lint:fix": "eslint . --ext .ts --fix", "test:node": "rimraf __tests__ && tsc -p tsconfig.test.json && c8 mocha", "test:browser": "karma start karma.conf.cjs" }, diff --git a/packages/web5/src/did-resolution-cache.ts b/packages/web5/src/did-resolution-cache.ts index 3637805c9..8969da7bb 100644 --- a/packages/web5/src/did-resolution-cache.ts +++ b/packages/web5/src/did-resolution-cache.ts @@ -74,4 +74,4 @@ export class DidResolutionCache implements DidResolverCache { return this.cache.close(); } -} \ No newline at end of file +} diff --git a/web5-js.code-workspace b/web5-js.code-workspace index 0585c6928..0e607ac7d 100644 --- a/web5-js.code-workspace +++ b/web5-js.code-workspace @@ -36,7 +36,13 @@ "path": "packages/web5-user-agent", }, ], - "settings": {}, + "settings": { + "eslint.workingDirectories": [ + { + "mode": "auto" + } + ], + }, "launch": { "version": "0.2.0", "configurations": [