feature: migration dvf en TypeScript
parse.js/sync.js/lib/dotenv.js -> .ts (run via tsx), ajout tsconfig.json, eslint config TS-enabled (parser tseslint + resolver typescript), devDeps typescript/typescript-eslint/tsx/eslint-import-resolver-typescript, scripts package.json en tsx + typecheck, .lintstagedrc *.ts, README en tsx. Fix securite: escapeId sur les identifiants de colonnes dans sync.ts (au lieu de backticks bruts) pour ne pas casser/injecter via un en-tete CSV distant. Suppression du todo.txt audit (finding escapeId traite). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+36
-1
@@ -5,6 +5,7 @@ import n from 'eslint-plugin-n';
|
||||
import raflint from 'eslint-plugin-raflint';
|
||||
import pluginimport from 'eslint-plugin-import-x';
|
||||
import babelParser from '@babel/eslint-parser';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import js from '@eslint/js';
|
||||
import globals from 'globals';
|
||||
|
||||
@@ -31,6 +32,7 @@ export default [
|
||||
ignores: ['legacy/', 'dist/', 'node_modules/', 'web/', 'public/', 'coverage/', 'data/', 'vendor/', 'react/', 'js/', 'assets/', '**/old/'],
|
||||
},
|
||||
{
|
||||
files: ['**/*.{js,mjs,cjs,ts}'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
@@ -47,8 +49,19 @@ export default [
|
||||
plugins: {
|
||||
raflint,
|
||||
},
|
||||
settings: {
|
||||
'import-x/resolver': {
|
||||
typescript: {
|
||||
alwaysTryTypes: true,
|
||||
noWarnOnMultipleProjects: true,
|
||||
project: ['tsconfig.json'],
|
||||
},
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'sonarjs/no-empty-function': 0,
|
||||
'unicorn/no-this-outside-of-class': 0,
|
||||
'sonarjs/no-unused-expressions': 0,
|
||||
'sonarjs/no-unsafe-unzip': 0,
|
||||
'sonarjs/os-command': 0,
|
||||
@@ -133,6 +146,7 @@ export default [
|
||||
'unicorn/prefer-ternary': 0,
|
||||
'unicorn/prefer-top-level-await': 0,
|
||||
'unicorn/prevent-abbreviations': 0,
|
||||
'unicorn/name-replacements': 0,
|
||||
'unicorn/consistent-compound-words': 0,
|
||||
// ne pas retirer `undefined` passe en argument (souvent requis par la signature -> casse tsc)
|
||||
'unicorn/no-useless-undefined': ['error', { checkArguments: false }],
|
||||
@@ -218,7 +232,6 @@ export default [
|
||||
'wrap-iife': ['error', 'inside'],
|
||||
yoda: 'error',
|
||||
'vars-on-top': 'error',
|
||||
radix: ['error', 'as-needed'],
|
||||
'prefer-regex-literals': 'error',
|
||||
'prefer-promise-reject-errors': 'error',
|
||||
'promise/catch-or-return': ['error', { terminationMethod: ['catch', 'finally'] }],
|
||||
@@ -285,4 +298,26 @@ export default [
|
||||
'prefer-const': ['error', { destructuring: 'all' }],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.ts'],
|
||||
languageOptions: {
|
||||
parser: tseslint.parser,
|
||||
},
|
||||
plugins: {
|
||||
'@typescript-eslint': tseslint.plugin,
|
||||
},
|
||||
rules: {
|
||||
// le compilo TS gère les globals/types : évite les faux positifs no-undef (Express, RequestInit)
|
||||
'no-undef': 'off',
|
||||
// la règle core ne comprend pas `import type`
|
||||
'no-duplicate-imports': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
// fichiers de déclaration générés (vite-env.d.ts) : nom imposé par la convention Vite
|
||||
files: ['**/*.d.ts'],
|
||||
rules: {
|
||||
'unicorn/filename-case': 'off',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user