From 2f0d12b98339e54a4f760566f5496bfc02c7bed8 Mon Sep 17 00:00:00 2001 From: qarlosalberto Date: Sun, 20 Oct 2024 11:22:04 +0200 Subject: [PATCH] fix: update eslint config --- .eslintignore | 4 ---- .eslintrc | 25 ------------------------ .eslintrc copy | 27 -------------------------- auto_package/script.yml | 2 +- copy_files2.py | 42 ----------------------------------------- eslint.config.js | 33 ++++++++++++++++++++++++++++++++ package.json | 2 +- 7 files changed, 35 insertions(+), 100 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc delete mode 100644 .eslintrc copy delete mode 100644 copy_files2.py create mode 100644 eslint.config.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 626941e2..00000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/ -build/ -src/formatter/bin -tmp/ diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 78156d1c..00000000 --- a/.eslintrc +++ /dev/null @@ -1,25 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "no-console": "warn", - "@typescript-eslint/semi": "warn", - "curly": "warn", - "eqeqeq": "warn", - "no-throw-literal": "warn", - "semi": "warn", - "max-len": [ - "warn", - { - "code": 120 - } - ] - } -} \ No newline at end of file diff --git a/.eslintrc copy b/.eslintrc copy deleted file mode 100644 index a1d63ac0..00000000 --- a/.eslintrc copy +++ /dev/null @@ -1,27 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": [ - "@typescript-eslint" - ], - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended", - "plugin:@typescript-eslint/recommended" - ], - "rules": { - "no-console": "warn", - "no-eval": "error", - "semi": "warn", - "eqeqeq": "warn", - "max-len": [ - "warn", - { - "code": 120 - } - ], - "no-tabs": "warn", - "curly": "warn", - "@typescript-eslint/no-var-requires": "off" - } -} \ No newline at end of file diff --git a/auto_package/script.yml b/auto_package/script.yml index 2cd640d7..1bc88aca 100644 --- a/auto_package/script.yml +++ b/auto_package/script.yml @@ -11,7 +11,7 @@ command: "npm run-script copy-files & npm run-script build-webviews & npm run-script build-webviews-configuration & tsc -p ./" - name: "lint" - command: "eslint src --ext ts" + command: "eslint src" - name: "watch" command: npm run-script copy-files & tsc --watch --p ./tsconfig.json & nodemon --ignore 'resources/webviews/reporters/**/wb/' --watch resources/webviews/reporters -e js,ts,tsx,html --exec \"npm run-script build-webviews\" diff --git a/copy_files2.py b/copy_files2.py deleted file mode 100644 index abe5b6b1..00000000 --- a/copy_files2.py +++ /dev/null @@ -1,42 +0,0 @@ -import os -import shutil - -import os -import shutil - -def copy_files_except_extensions(src_dir, out_dir, excluded_extensions): - """ - Copy files from the source directory to the output directory, excluding files with specified extensions. - - Args: - src_dir (str): The path to the source directory. - out_dir (str): The path to the output directory. - excluded_extensions (list): A list of file extensions to exclude. - - Returns: - None - """ - for root, dirs, files in os.walk(src_dir): - for file in files: - if not any(file.endswith(ext) for ext in excluded_extensions): - src_path = os.path.abspath(os.path.join(root, file)) - - src_path_parent_dir = os.path.relpath(root, src_dir) - if len(src_path_parent_dir.split(os.sep)) > 1: - src_path_parent_dir = f"{os.sep}".join(src_path_parent_dir.split(os.sep)[1:]) - else: - src_path_parent_dir = "." - - complete_dest_path = os.path.abspath(os.path.join(out_dir, src_path_parent_dir, file)) - - os.makedirs(os.path.dirname(complete_dest_path), exist_ok=True) - shutil.copy2(src_path, complete_dest_path) - -src_directory = '../colibri/src' -out_directory = 'build' - -excluded_extensions = ['.ts', '.js', '.log'] - -copy_files_except_extensions(src_directory, out_directory, excluded_extensions) - -print("Files copied successfully!") diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..25fadf85 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,33 @@ +const parser = require('@typescript-eslint/parser'); +const eslintPlugin = require('@typescript-eslint/eslint-plugin'); + +module.exports = { + languageOptions: { + parser: parser, + ecmaVersion: 6, + sourceType: 'module' + }, + plugins: { + '@typescript-eslint': eslintPlugin, + }, + files: ["src/**/*.ts"], + ignores: [ + 'node_modules', + 'build', + 'src/formatter/bin', + 'tmp', + ], + rules: { + 'no-console': 'warn', + 'curly': 'warn', + 'eqeqeq': 'warn', + 'no-throw-literal': 'warn', + 'semi': 'warn', + 'max-len': [ + 'warn', + { + code: 120 + } + ] + } +}; \ No newline at end of file diff --git a/package.json b/package.json index 6dc6b880..312fc710 100644 --- a/package.json +++ b/package.json @@ -834,7 +834,7 @@ "clean": "shx rm -rf out", "vscode:prepublish": "npm run generate-examples & npm run compile", "compile": "npm run-script copy-files & npm run-script build-webviews & npm run-script build-webviews-configuration & tsc -p ./", - "lint": "eslint src --ext ts", + "lint": "eslint src", "watch": "npm run-script copy-files & tsc --watch --p ./tsconfig.json & nodemon --ignore 'resources/webviews/reporters/**/wb/' --watch resources/webviews/reporters -e js,ts,tsx,html --exec \"npm run-script build-webviews\"", "generate-examples": "cd ./resources/project_manager; ./copy_examples.sh", "pre-package": "mkdir ./node_modules/teroshdl2/node_modules/onml/lib; cp ./node_modules/teroshdl2/node_modules/onml/*.js ./node_modules/teroshdl2/node_modules/onml/lib",