diff --git a/first-class-pipeline/resources/com/freeleaps/devops/builtins/lint/eslint/eslintrc.js b/first-class-pipeline/resources/com/freeleaps/devops/builtins/lint/eslint/eslintrc.js new file mode 100644 index 00000000..2029082f --- /dev/null +++ b/first-class-pipeline/resources/com/freeleaps/devops/builtins/lint/eslint/eslintrc.js @@ -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"], +}; diff --git a/first-class-pipeline/resources/com/freeleaps/devops/builtins/lint/eslint/eslintrc.json b/first-class-pipeline/resources/com/freeleaps/devops/builtins/lint/eslint/eslintrc.json deleted file mode 100644 index 5dfecab7..00000000 --- a/first-class-pipeline/resources/com/freeleaps/devops/builtins/lint/eslint/eslintrc.json +++ /dev/null @@ -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"] -} diff --git a/first-class-pipeline/src/com/freeleaps/devops/CodeLintExecutor.groovy b/first-class-pipeline/src/com/freeleaps/devops/CodeLintExecutor.groovy index 1d4141f3..1ec40c1f 100644 --- a/first-class-pipeline/src/com/freeleaps/devops/CodeLintExecutor.groovy +++ b/first-class-pipeline/src/com/freeleaps/devops/CodeLintExecutor.groovy @@ -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") diff --git a/first-class-pipeline/src/com/freeleaps/devops/lint/ESLint.groovy b/first-class-pipeline/src/com/freeleaps/devops/lint/ESLint.groovy index 52c96047..5c70be49 100644 --- a/first-class-pipeline/src/com/freeleaps/devops/lint/ESLint.groovy +++ b/first-class-pipeline/src/com/freeleaps/devops/lint/ESLint.groovy @@ -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...")