From 9b8134441c8bf6181fb8db1e3159a1c53ea463b2 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Jan 2026 01:45:31 +0100 Subject: [PATCH] up --- .eslintrc.json | 30 ---------------------- eslint.config.js | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + src/extension.ts | 6 ++--- 4 files changed, 70 insertions(+), 33 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 86c86f3..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "@typescript-eslint/naming-convention": [ - "warn", - { - "selector": "import", - "format": [ "camelCase", "PascalCase" ] - } - ], - "@typescript-eslint/semi": "warn", - "curly": "warn", - "eqeqeq": "warn", - "no-throw-literal": "warn", - "semi": "off" - }, - "ignorePatterns": [ - "out", - "dist", - "**/*.d.ts" - ] -} \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..2414fa7 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,66 @@ +import js from '@eslint/js'; +import tsparser from '@typescript-eslint/parser'; +import tsplugin from '@typescript-eslint/eslint-plugin'; +import globals from 'globals'; + +export default [ + js.configs.recommended, + { + files: ['**/*.ts'], + languageOptions: { + parser: tsparser, + parserOptions: { + ecmaVersion: 6, + sourceType: 'module', + }, + globals: { + ...globals.browser, + ...globals.node, + ...globals.mocha, + }, + }, + plugins: { + '@typescript-eslint': tsplugin, + }, + rules: { + '@typescript-eslint/naming-convention': [ + 'warn', + { + selector: 'import', + format: ['camelCase', 'PascalCase'], + }, + ], + 'curly': 'warn', + 'eqeqeq': 'warn', + 'no-throw-literal': 'warn', + 'semi': 'off', + // Règles générales réutilisées de flatbay + 'prefer-const': ['error', { destructuring: 'all' }], + 'no-var': 'error', + 'object-shorthand': ['error', 'properties'], + 'prefer-template': 'error', + 'dot-notation': 'error', + 'no-unused-expressions': 'error', + 'no-nested-ternary': 'error', + 'one-var-declaration-per-line': ['error', 'always'], + 'one-var': ['error', 'never'], + 'vars-on-top': 'error', + 'yoda': 'error', + 'prefer-arrow-callback': 'error', + 'no-implicit-globals': 'error', + 'no-labels': 'error', + 'no-new-func': 'error', + 'no-script-url': 'error', + 'no-sequences': 'error', + 'no-unused-labels': 'error', + 'prefer-spread': 'error', + 'no-console': 0, // Garder les console.log pour debug + 'no-empty': 0, + 'no-redeclare': 0, + 'no-useless-escape': 0, + }, + }, + { + ignores: ['out/', 'dist/', '**/*.d.ts'], + }, +]; diff --git a/package.json b/package.json index e7121a7..74abdbf 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "license": "ISC", "author": "Raphael Piccolo", + "type": "module", "main": "./out/extension.js", "scripts": { "compile": "tsc -p ./", diff --git a/src/extension.ts b/src/extension.ts index e3ad9e0..96ba009 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -4,13 +4,13 @@ export function activate(context: vscode.ExtensionContext) { console.log('Congratulations, your extension "vscodestat" is now active!'); // crée une commande de test - let disposable = vscode.commands.registerCommand('vscodestat.helloWorld', () => { + const disposable = vscode.commands.registerCommand('vscodestat.helloWorld', () => { vscode.window.showInformationMessage('Hello World from vscodestat!'); }); context.subscriptions.push(disposable); // commande pour definir l'url - let disposable2 = vscode.commands.registerCommand('vscodestat.setUrl', async () => { + const disposable2 = vscode.commands.registerCommand('vscodestat.setUrl', async () => { const url = await vscode.window.showInputBox({ prompt: 'Enter the URL:', placeHolder: '' @@ -24,7 +24,7 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(disposable2); // commande pour tester l'url - let disposable3 = vscode.commands.registerCommand('vscodestat.callUrl', async () => { + const disposable3 = vscode.commands.registerCommand('vscodestat.callUrl', async () => { const storedUrl = vscode.workspace.getConfiguration().get('vscodestat.url') as string; if (!storedUrl) { vscode.window.showWarningMessage('URL is not set. Please set the URL first.');