This commit is contained in:
2026-01-23 01:45:31 +01:00
parent d16bc0a1ef
commit 9b8134441c
4 changed files with 70 additions and 33 deletions

View File

@@ -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"
]
}

66
eslint.config.js Normal file
View File

@@ -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'],
},
];

View File

@@ -12,6 +12,7 @@
}, },
"license": "ISC", "license": "ISC",
"author": "Raphael Piccolo", "author": "Raphael Piccolo",
"type": "module",
"main": "./out/extension.js", "main": "./out/extension.js",
"scripts": { "scripts": {
"compile": "tsc -p ./", "compile": "tsc -p ./",

View File

@@ -4,13 +4,13 @@ export function activate(context: vscode.ExtensionContext) {
console.log('Congratulations, your extension "vscodestat" is now active!'); console.log('Congratulations, your extension "vscodestat" is now active!');
// crée une commande de test // 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!'); vscode.window.showInformationMessage('Hello World from vscodestat!');
}); });
context.subscriptions.push(disposable); context.subscriptions.push(disposable);
// commande pour definir l'url // 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({ const url = await vscode.window.showInputBox({
prompt: 'Enter the URL:', prompt: 'Enter the URL:',
placeHolder: '' placeHolder: ''
@@ -24,7 +24,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(disposable2); context.subscriptions.push(disposable2);
// commande pour tester l'url // 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; const storedUrl = vscode.workspace.getConfiguration().get('vscodestat.url') as string;
if (!storedUrl) { if (!storedUrl) {
vscode.window.showWarningMessage('URL is not set. Please set the URL first.'); vscode.window.showWarningMessage('URL is not set. Please set the URL first.');