Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Feat(root): Apply Eslint and Integrate with Prettier #135

Merged
merged 8 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small note, for libraries that use universal config (i.e. "rc", "json", "js"), we prefer JS (because it has comment) or JSON (because vscode auto has schema for them). The "rc" one is quite limited

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait I'm wrong! VSCode recognize .rc file!

"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
// prettier should be the last of extends to override other configs
// more info: https://github.com/prettier/eslint-config-prettier
"prettier"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"no-console": "warn"
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
dist
.DS_Store
.idea
.idea
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@moai/root",
"scripts": {
"lint": "eslint --ext .ts,.tsx,.js --ignore-path .gitignore .",
"lint:fix": "eslint --fix --ext .ts,.tsx,.js --ignore-path .gitignore ."
},
"lint-staged": {
"*.{ts,tsx,js,css,json}": "prettier --write"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "4.21.0",
"@typescript-eslint/parser": "4.21.0",
"eslint": "7.23.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-react": "7.23.2",
"husky": "6.0.0",
"lint-staged": "10.5.4",
"prettier": "2.2.1",
"typescript": "4.2.3"
}
}