mirror of
https://github.com/haveno-dex/haveno-ts.git
synced 2025-04-15 13:33:13 -04:00
add eslint and editorconfig
This commit adds a simple editorconfig generated via VSCode and .eslintrc.json configuration created with 'npx eslint --init'. The rules are react-specific typescript recommnedations with the Airbnb style guide. Linting can be performed by running 'npm run lint' or fix possible errors with 'npm run eslintfix'. These commands are located in the pacakge.json 'scripts' configuration. Place file extensions and directories to be ignored in .eslintignore.
This commit is contained in:
parent
e35f8c5e95
commit
67d236f7cf
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = false
|
||||
insert_final_newline = false
|
3
.eslintignore
Normal file
3
.eslintignore
Normal file
@ -0,0 +1,3 @@
|
||||
*.css
|
||||
*.svg
|
||||
*.png
|
42
.eslintrc.json
Normal file
42
.eslintrc.json
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:react/recommended",
|
||||
"airbnb"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
},
|
||||
"ecmaVersion": 12,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"react",
|
||||
"react-hooks",
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"no-use-before-define": "off",
|
||||
"@typescript-eslint/no-use-before-define": ["error"],
|
||||
"react/jsx-filename-extension": [ "warn", {"extensions": [".tsx"]}],
|
||||
"import/extensions": ["error","ignorePackages",{"ts": "never", "tsx": "never" }],
|
||||
"@typescript-eslint/explicit-function-return-type": ["error",{"allowExpressions": true}],
|
||||
"no-shadow": "off", "@typescript-eslint/no-shadow": ["error"],
|
||||
"max-len": ["warn", { "code": 80 }],
|
||||
"react-hooks/rules-of-hooks": "error",
|
||||
"react-hooks/exhaustive-deps": "warn",
|
||||
"import/prefer-default-export": "off",
|
||||
"react/prop-types": "off"
|
||||
},
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"typescript": {}
|
||||
}
|
||||
}
|
||||
}
|
19
package.json
19
package.json
@ -22,13 +22,9 @@
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
"eject": "react-scripts eject",
|
||||
"lint": "eslint src/*",
|
||||
"eslintfix": "eslint src/* --fix"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
@ -43,6 +39,15 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^4.31.1",
|
||||
"@typescript-eslint/parser": "^4.31.1",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-airbnb": "^18.2.1",
|
||||
"eslint-import-resolver-typescript": "^2.5.0",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-react": "^7.25.2",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"monero-javascript": "^0.5.5"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user