Skip to content
Snippets Groups Projects
Commit c2ae41c8 authored by Thibaut DE SAIVRE's avatar Thibaut DE SAIVRE
Browse files

finish eslint configuration

parent fbe00361
No related branches found
No related tags found
No related merge requests found
// Use CommonJS to enable extending this config, and using comments
module.exports = {
root: true,
// Extended config & plugins (recommended ones)
extends: ['prettier', 'eslint:recommended', 'plugin:@typescript-eslint/recommended'],
plugins: ['@typescript-eslint', 'prettier'],
parser: '@typescript-eslint/parser',
// Typescript parser
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
// Custom eslint rules
rules: {
'no-console': ['warn', { allow: ['error', 'warn', 'info'] }], // Warn when using console.log, which should only be used for debugging
'import/no-unresolved': 0,
// ***** Prettier rules ****** //
// This will warn when the file is not formatted correctly. Running prettier will fix these errors
'prettier/prettier': [
'error',
{
singleQuote: true,
trailingComma: 'es5',
arrowParens: 'always',
endOfLine: 'auto',
tabWidth: 2,
semi: true,
},
],
// ***** Typescript rules ****** //
// Allow not adding a blank line between single line class members (typically attributes)
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
// Warnings
'curly': 'off', // Prefer always using curly braces rather than one line condition statements
// Off
'import/extensions': 'off', // Disable file extension checks (.types.ts, etc)
'no-param-reassign': 'off', // Enable direct assignment of values to object parameters
'import/prefer-default-export': 'off',
'no-use-before-define': 'off', // Allow using functions before they are defined in the same file
'class-methods-use-this': 'off', // Avoid having to specify "this.something" in class methods all the time
'@typescript-eslint/no-empty-interface': 'off', // Allow empty interfaces
'no-useless-constructor': 'off', // Allow empty constructors
},
};
This diff is collapsed.
...@@ -7,5 +7,12 @@ ...@@ -7,5 +7,12 @@
"execute": "node build/index.js", "execute": "node build/index.js",
"lint": "eslint . --ext=.ts", "lint": "eslint . --ext=.ts",
"format": "prettier --write ." "format": "prettier --write ."
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.7.5",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"prettier": "^3.0.3"
} }
} }
/** Print the message to console */ /** Print the message to console */
export const func = (message: string) => { export const func = (message: string) => {
console.log(message); console.info(message);
}; };
// TODO : normalement ici on aura des erreurs
const test = (arg: any) => {};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment