refactor(lint): migrate ESLint configuration from JSON to JS format and update related references
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
f9d10df52d
commit
39cb4fc56a
@ -0,0 +1,18 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: "@typescript-eslint/parser",
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: "module",
|
||||
},
|
||||
plugins: ["@typescript-eslint"],
|
||||
rules: {
|
||||
"@typescript-eslint/naming-convention": "warn",
|
||||
"@typescript-eslint/semi": "warn",
|
||||
curly: "warn",
|
||||
eqeqeq: "warn",
|
||||
"no-throw-literal": "warn",
|
||||
semi: "off",
|
||||
},
|
||||
ignorePatterns: ["out", "dist", "**/*.d.ts"],
|
||||
};
|
||||
@ -1,18 +0,0 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"rules": {
|
||||
"@typescript-eslint/naming-convention": "warn",
|
||||
"@typescript-eslint/semi": "warn",
|
||||
"curly": "warn",
|
||||
"eqeqeq": "warn",
|
||||
"no-throw-literal": "warn",
|
||||
"semi": "off"
|
||||
},
|
||||
"ignorePatterns": ["out", "dist", "**/*.d.ts"]
|
||||
}
|
||||
@ -27,7 +27,7 @@ class CodeLintExecutor {
|
||||
configFilePath = "com/freeleaps/devops/builtins/lint/pylint/pylintrc"
|
||||
break
|
||||
case CodeLinterTypes.ESLINT:
|
||||
configFilePath = "com/freeleaps/devops/builtins/lint/eslint/eslintrc.json"
|
||||
configFilePath = "com/freeleaps/devops/builtins/lint/eslint/eslintrc.js"
|
||||
break
|
||||
default:
|
||||
steps.log.error("CodeLintExecutor", "Unknown linter type")
|
||||
|
||||
@ -24,9 +24,9 @@ class ESLint extends LinterBase {
|
||||
steps.log.info("${linterType.linter}", "Install eslint dependencies...")
|
||||
steps.sh("npm install -g ${deps.join(' ')}")
|
||||
// check if given config file is not end with .json
|
||||
if (!configs.endsWith('.json')) {
|
||||
steps.log.warn("${linterType.linter}", "Invalid eslint configuration file, must be a JSON file, convert file as valid JSON file...")
|
||||
steps.sh("mv ${configs} ${configs}.json")
|
||||
if (!configs.endsWith('.js')) {
|
||||
steps.log.warn("${linterType.linter}", "Invalid eslint configuration file, must be a JS file, convert file as valid JS file...")
|
||||
steps.sh("mv ${configs} ${configs}.js")
|
||||
configs = "${configs}.json"
|
||||
}
|
||||
steps.log.info("${linterType.linter}", "Running eslint...")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user