**Motivations:** - Initialisation du versionning git pour le projet **Root causes:** - N/A (Nouveau projet) **Correctifs:** - N/A **Evolutions:** - Structure initiale du projet - Ajout du .gitignore **Pages affectées:** - Tous les fichiers
104 lines
3.2 KiB
JavaScript
104 lines
3.2 KiB
JavaScript
/**
|
||
* ESLint flat config – project rules (Rappel des grandes règles / qualité du code).
|
||
* Applies to web/js and server (excluding node_modules).
|
||
* Run: npm run lint
|
||
*/
|
||
const js = require("@eslint/js");
|
||
const jsdoc = require("eslint-plugin-jsdoc");
|
||
|
||
module.exports = [
|
||
js.configs.recommended,
|
||
{
|
||
files: ["web/js/**/*.js", "server/**/*.js"],
|
||
ignores: ["**/node_modules/**", "server/node_modules/**"],
|
||
plugins: { jsdoc: jsdoc },
|
||
languageOptions: {
|
||
ecmaVersion: 2022,
|
||
sourceType: "module",
|
||
globals: {
|
||
window: "readonly",
|
||
document: "readonly",
|
||
localStorage: "readonly",
|
||
fetch: "readonly",
|
||
setInterval: "readonly",
|
||
clearInterval: "readonly",
|
||
setTimeout: "readonly",
|
||
clearTimeout: "readonly",
|
||
performance: "readonly",
|
||
console: "readonly",
|
||
URL: "readonly",
|
||
URLSearchParams: "readonly",
|
||
Blob: "readonly",
|
||
btoa: "readonly",
|
||
atob: "readonly",
|
||
crypto: "readonly",
|
||
TextEncoder: "readonly",
|
||
navigator: "readonly",
|
||
CustomEvent: "readonly",
|
||
Event: "readonly",
|
||
HTMLElement: "readonly",
|
||
Node: "readonly",
|
||
Element: "readonly",
|
||
MutationObserver: "readonly",
|
||
ResizeObserver: "readonly",
|
||
requestAnimationFrame: "readonly",
|
||
cancelAnimationFrame: "readonly",
|
||
getComputedStyle: "readonly",
|
||
addEventListener: "readonly",
|
||
removeEventListener: "readonly",
|
||
dispatchEvent: "readonly",
|
||
},
|
||
},
|
||
rules: {
|
||
"max-lines": ["error", { max: 250, skipBlankLines: true, skipComments: true }],
|
||
"max-lines-per-function": ["error", { max: 40, skipBlankLines: true, skipComments: true }],
|
||
"max-params": ["error", 4],
|
||
"max-depth": ["error", 4],
|
||
"complexity": ["warn", { max: 10 }],
|
||
"no-unused-vars": [
|
||
"error",
|
||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrorsIgnorePattern: "^_" },
|
||
],
|
||
"eqeqeq": ["error", "always"],
|
||
"no-implicit-coercion": "warn",
|
||
"no-var": "error",
|
||
"prefer-const": "warn",
|
||
"no-else-return": "warn",
|
||
"no-continue": "error",
|
||
"no-labels": "error",
|
||
"prefer-arrow-callback": "warn",
|
||
"no-param-reassign": ["error", { props: false }],
|
||
"no-throw-literal": "error",
|
||
"require-await": "warn",
|
||
"no-console": ["warn", { allow: ["warn", "error"] }],
|
||
"no-debugger": "error",
|
||
"no-alert": "error",
|
||
"no-eval": "error",
|
||
"no-implied-eval": "error",
|
||
"no-new-func": "error",
|
||
"no-constructor-return": "error",
|
||
"no-duplicate-imports": "warn",
|
||
"no-unreachable": "warn",
|
||
"no-shadow": "warn",
|
||
"jsdoc/require-returns": ["warn", { forceReturnsWithAsync: true }],
|
||
"jsdoc/check-param-names": "warn",
|
||
"jsdoc/require-param-description": "off",
|
||
"jsdoc/require-returns-description": "off",
|
||
},
|
||
},
|
||
{
|
||
files: ["server/**/*.js"],
|
||
ignores: ["server/node_modules/**"],
|
||
languageOptions: {
|
||
globals: {
|
||
process: "readonly",
|
||
__dirname: "readonly",
|
||
__filename: "readonly",
|
||
module: "readonly",
|
||
require: "readonly",
|
||
Buffer: "readonly",
|
||
},
|
||
},
|
||
},
|
||
];
|