Skip to content

Commit

Permalink
linagora#3 Migrate to ESlint and code formatting using prettier and h…
Browse files Browse the repository at this point in the history
…uskey
  • Loading branch information
Rachid OUBRAIM committed Jan 14, 2021
1 parent 3ed996d commit 9c4edf8
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 10 deletions.
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
extends: [
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
},
};
6 changes: 6 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"hooks": {
"pre-commit": "lint-staged",
"pre-push":"npm run test"
}
}
5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"*.{js,ts}": [
"eslint --fix"
]
}
7 changes: 6 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"singleQuote": true
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"semi": true,
"trailingComma":"all",
"arrowParens": "avoid"
}
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"scripts": {
"build": "tsc",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "tslint -p tsconfig.json",
"lint": "eslint 'src/**/*.{js,ts}' --ext .ts --quiet --fix",
"lint:no-fix": "eslint 'src/**/*.{js,ts}' --ext .ts",
"lint:prettier": "prettier --config .prettierrc \"src/**/*.ts\"",
"test": "mocha -r ts-node/register -r jsdom-global/register **/*.spec.ts",
"prepare": "npm run build",
"prePublish": "npm run build"
Expand Down Expand Up @@ -34,14 +36,19 @@
"devDependencies": {
"@types/chai": "4.1.3",
"@types/mocha": "8.0.3",
"@typescript-eslint/eslint-plugin": "^4.13.0",
"@typescript-eslint/parser": "^4.13.0",
"chai": "4.2.0",
"eslint": "^7.17.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-prettier": "^3.3.1",
"husky": "^4.3.7",
"jsdom": "16.4.0",
"jsdom-global": "3.0.2",
"lint-staged": "^10.5.3",
"mocha": "8.1.3",
"prettier": "2.1.2",
"ts-node": "9.0.0",
"tslint": "6.1.3",
"tslint-config-prettier": "1.18.0",
"typescript": "4.0.3"
}
}
6 changes: 0 additions & 6 deletions tslint.json

This file was deleted.

0 comments on commit 9c4edf8

Please sign in to comment.