Skip to content

Commit

Permalink
#3 Migrate to ESlint and code formatting using prettier and huskey
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachid OUBRAIM committed Jan 14, 2021
1 parent 3ed996d commit d10865e
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 11 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 lint && npm run test"
}
}
5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"*.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: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "jmap-client-ts.js",
"scripts": {
"build": "tsc",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "tslint -p tsconfig.json",
"lint": "eslint 'src/**/*.ts'",
"lint:fix": "npm run lint -- --quiet --fix",
"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 +34,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 d10865e

Please sign in to comment.