Skip to content

Commit

Permalink
Add eslint with configuration
Browse files Browse the repository at this point in the history
Also add overcommit rule for ESlint.
  • Loading branch information
UnsolvedCypher authored and viroulep committed Mar 27, 2020
1 parent 7ea53dc commit 9b4dc8b
Show file tree
Hide file tree
Showing 5 changed files with 2,030 additions and 1,463 deletions.
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"esversion": 8,
"esversion": 9,
"asi": true
}
13 changes: 13 additions & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ PreCommit:
- '**/*.jar'
- '**/*.svg'

EsLint:
required_executable: 'WcaOnRails/bin/yarn'
enabled: true
include:
- 'WcaOnRails/app/javascript/**/*.js[x]'
exclude:
# FIXME: we could fix it, but it's long and it's legacy code anyway...
- 'WcaOnRails/app/javascript/edit-events/**/*.js[x]'
command: ['WcaOnRails/bin/yarn', 'run', 'eslint', '-c', '.eslintrc.json', '-f', 'compact']

RuboCop:
enabled: true
on_warn: fail # Treat all warnings as failures
Expand All @@ -46,6 +56,9 @@ PreCommit:

JsHint:
enabled: true
include:
# Others are handled by EsLint
'WcaOnRails/app/assets'
required_executable: 'WcaOnRails/bin/yarn'
flags: ['run', '-s', 'jshint', '--verbose']

Expand Down
28 changes: 28 additions & 0 deletions WcaOnRails/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"env": {
"browser": true,
"es6": true,
"jquery": true
},
"extends": [
"plugin:react/recommended",
"airbnb"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
"_": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react",
"jquery"
],
"rules": {}
}
9 changes: 8 additions & 1 deletion WcaOnRails/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"classnames": "^2.2.6",
"compression-webpack-plugin": "^3.1.0",
"css-loader": "^3.4.2",
"easymde": "^2.9.0",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^4.2.0",
"flag-icon-css": "viroulep/flag-icon-css#3.2.1-xk",
Expand All @@ -43,14 +44,20 @@
"react-leaflet": "^2.6.3",
"resolve-url-loader": "^3.1.1",
"sass-loader": "^8.0.2",
"easymde": "^2.9.0",
"style-loader": "^1.1.3",
"webpack": "^4.42.0",
"webpack-manifest-plugin": "^2.2.0",
"webpack-merge": "^4.2.2",
"whatwg-fetch": "^3.0.0"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jquery": "^1.5.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react-hooks": "^2.4.0",
"jshint": "^2.11.0",
"stylelint": "^12.0.1",
"stylelint-config-recommended-scss": "^4.2.0",
Expand Down
Loading

0 comments on commit 9b4dc8b

Please sign in to comment.