From b0fc0e78033b21e5d42f6664dc1398d00fa377e3 Mon Sep 17 00:00:00 2001 From: David Liu Date: Sun, 5 May 2024 20:35:23 +0800 Subject: [PATCH] update eslint config --- .eslintrc.json | 73 ------------------------- eslint.config.js | 137 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 - 3 files changed, 137 insertions(+), 74 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.js diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 9e0b9c94..00000000 --- a/.eslintrc.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "env": { - "es6": true, - "node": true, - "mocha": true - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaVersion": 2017, - "sourceType": "module" - }, - "rules": { - "array-bracket-spacing": ["error", "never"], - "arrow-spacing": ["error"], - "brace-style": ["error"], - "comma-spacing": ["error"], - "curly": ["error"], - "dot-notation": ["error"], - "eqeqeq": ["error"], - "indent": [ - "error", - "tab", - { - "SwitchCase": 1 - } - ], - "keyword-spacing": ["error"], - "linebreak-style": ["error", "unix"], - "max-len": [ - "error", - { - "code": 150, - "ignoreTrailingComments": true, - "ignoreUrls": true, - "ignoreStrings": true, - "ignoreTemplateLiterals": true, - "ignoreRegExpLiterals": true - } - ], - "no-console": ["warn"], - "no-mixed-spaces-and-tabs": ["error"], - "no-shadow": ["error"], - "no-throw-literal": ["error"], - "no-trailing-spaces": ["error"], - "no-useless-call": ["error"], - "no-unused-vars": [ - "error", - { - "args": "none" - } - ], - "no-var": ["error"], - "no-with": ["error"], - "object-curly-spacing": ["error", "never"], - "operator-linebreak": ["error"], - "prefer-arrow-callback": ["error"], - "prefer-const": ["error"], - "quotes": ["error", "single"], - "semi": ["error", "always"], - "spaced-comment": ["error", "always"], - "space-before-blocks": [ - "error", - { - "functions": "always", - "keywords": "always", - "classes": "always" - } - ], - "space-infix-ops": ["error"], - "space-in-parens": ["error", "never"], - "yoda": ["error"] - } -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..70e358e5 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,137 @@ +import globals from 'globals'; +import js from '@eslint/js'; + +export default [ + js.configs.recommended, + { + rules: { + 'array-bracket-spacing': [ + 'error', + 'never' + ], + 'arrow-spacing': [ + 'error' + ], + 'brace-style': [ + 'error' + ], + 'comma-spacing': [ + 'error' + ], + 'curly': [ + 'error' + ], + 'dot-notation': [ + 'error' + ], + 'eqeqeq': [ + 'error' + ], + 'indent': [ + 'error', + 'tab', + { + 'SwitchCase': 1 + } + ], + 'keyword-spacing': [ + 'error' + ], + 'linebreak-style': [ + 'error', + 'unix' + ], + 'max-len': [ + 'error', + { + 'code': 150, + 'ignoreTrailingComments': true, + 'ignoreUrls': true, + 'ignoreStrings': true, + 'ignoreTemplateLiterals': true, + 'ignoreRegExpLiterals': true + } + ], + 'no-console': [ + 'warn' + ], + 'no-mixed-spaces-and-tabs': [ + 'error' + ], + 'no-shadow': [ + 'error' + ], + 'no-throw-literal': [ + 'error' + ], + 'no-trailing-spaces': [ + 'error' + ], + 'no-useless-call': [ + 'error' + ], + 'no-unused-vars': [ + 'error', + { + 'args': 'none' + } + ], + 'no-var': [ + 'error' + ], + 'no-with': [ + 'error' + ], + 'object-curly-spacing': [ + 'error', + 'never' + ], + 'operator-linebreak': [ + 'error' + ], + 'prefer-arrow-callback': [ + 'error' + ], + 'prefer-const': [ + 'error' + ], + 'quotes': [ + 'error', + 'single' + ], + 'semi': [ + 'error', + 'always' + ], + 'spaced-comment': [ + 'error', + 'always' + ], + 'space-before-blocks': [ + 'error', + { + 'functions': 'always', + 'keywords': 'always', + 'classes': 'always' + } + ], + 'space-infix-ops': [ + 'error' + ], + 'space-in-parens': [ + 'error', + 'never' + ], + 'yoda': [ + 'error' + ] + }, + languageOptions: { + ecmaVersion: 2023, + sourceType: 'module', + globals: { + ...globals.mocha, ...globals.es2021, ...globals.node + } + } + } +]; diff --git a/package.json b/package.json index f1c5797a..b6ed6c7d 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "prestart": "mocha dockerode-bootstrap.js --grep ^up --bail", "start": "mocha app/channelSetup.js", "post-start": "mocha ./cc/golang/diagnose/install.js", - "nodejscc": "mocha ./cc/node/diagnose/install.js", "stop": "mocha dockerode-bootstrap.js --grep ^down" }, "license": "Apache-2.0",