Skip to content

Commit 56587e8

Browse files
author
Rachid OUBRAIM
committed
linagora#3 Migrate to ESlint and code formatting using prettier and huskey
1 parent 3ed996d commit 56587e8

File tree

6 files changed

+43
-10
lines changed

6 files changed

+43
-10
lines changed

Diff for: .eslintrc.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
ecmaVersion: 2020,
5+
sourceType: 'module',
6+
},
7+
extends: [
8+
'plugin:@typescript-eslint/recommended',
9+
'prettier/@typescript-eslint',
10+
'plugin:prettier/recommended',
11+
],
12+
rules: {
13+
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
14+
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
15+
},
16+
};

Diff for: .huskyrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"hooks": {
3+
"pre-commit": "lint-staged",
4+
"pre-push":"npm run test"
5+
}
6+
}

Diff for: .lintstagedrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"*.{js,ts}": [
3+
"eslint --fix"
4+
]
5+
}

Diff for: .prettierrc

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
{
2-
"singleQuote": true
2+
"singleQuote": true,
3+
"printWidth": 100,
4+
"tabWidth": 2,
5+
"semi": true,
6+
"trailingComma":"all",
7+
"arrowParens": "avoid"
38
}

Diff for: package.json

+10-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"scripts": {
77
"build": "tsc",
88
"format": "prettier --write \"src/**/*.ts\"",
9-
"lint": "tslint -p tsconfig.json",
9+
"lint": "eslint 'src/**/*.{js,ts}' .ts --quiet --fix",
10+
"lint:no-fix": "eslint 'src/**/*.{js,ts}' --ext .ts",
11+
"lint:prettier": "prettier --config .prettierrc \"src/**/*.ts\"",
1012
"test": "mocha -r ts-node/register -r jsdom-global/register **/*.spec.ts",
1113
"prepare": "npm run build",
1214
"prePublish": "npm run build"
@@ -34,14 +36,19 @@
3436
"devDependencies": {
3537
"@types/chai": "4.1.3",
3638
"@types/mocha": "8.0.3",
39+
"@typescript-eslint/eslint-plugin": "^4.13.0",
40+
"@typescript-eslint/parser": "^4.13.0",
3741
"chai": "4.2.0",
42+
"eslint": "^7.17.0",
43+
"eslint-config-prettier": "^7.1.0",
44+
"eslint-plugin-prettier": "^3.3.1",
45+
"husky": "^4.3.7",
3846
"jsdom": "16.4.0",
3947
"jsdom-global": "3.0.2",
48+
"lint-staged": "^10.5.3",
4049
"mocha": "8.1.3",
4150
"prettier": "2.1.2",
4251
"ts-node": "9.0.0",
43-
"tslint": "6.1.3",
44-
"tslint-config-prettier": "1.18.0",
4552
"typescript": "4.0.3"
4653
}
4754
}

Diff for: tslint.json

-6
This file was deleted.

0 commit comments

Comments
 (0)