Skip to content

Commit 1ef1317

Browse files
authoredSep 20, 2023
Merge pull request #15 from smaht-dac/bm-prettier-config
Bm-prettier-config
2 parents a938525 + 92995e8 commit 1ef1317

5 files changed

+1919
-85
lines changed
 

‎.eslintrc.json

+19-22
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,29 @@
11
{
2-
"rules": {
2+
"rules": {
33
"array-callback-return" : "error",
4-
"arrow-body-style" : ["error", "as-needed", { "requireReturnForObjectLiteral": true }],
5-
"arrow-parens" : ["error", "always"],
6-
"generator-star-spacing" : "error",
7-
"indent": [2, 4, {"SwitchCase": 1}],
8-
"getter-return" :"error",
9-
"jsx-quotes" : ["error", "prefer-double"],
10-
"linebreak-style": [2, "unix"],
114
"new-cap" : "error",
125
"no-await-in-loop": "error",
136
"no-console": 0,
147
"no-empty": 0,
158
"no-global-assign" : "error",
169
"no-invalid-this" : "error",
17-
"no-tabs" : "error",
18-
"no-trailing-spaces" : "error",
1910
"no-undef": 0,
2011
"no-unused-vars": ["warn", { "args" : "none" }],
2112
"no-useless-concat": "error",
2213
"no-useless-constructor": "error",
23-
"no-whitespace-before-property" : "error",
24-
"object-curly-spacing" : ["error", "always"],
2514
"prefer-const" : "error",
2615
"prefer-destructuring" : "warn",
2716
"prefer-spread" : "error",
17+
"prettier/prettier": "error",
18+
// Do not add rules options for prettier config here; it will interfere with editor extensions
19+
// See: https://github.com/prettier/eslint-plugin-prettier#options
2820
"react/button-has-type" : "error",
2921
"react/destructuring-assignment" : ["warn", "always"],
3022
"react/display-name" : 0,
31-
"react/jsx-closing-tag-location" : "error",
32-
"react/jsx-indent" : "error",
33-
"react/jsx-indent-props" : "error",
3423
"react/jsx-key" : "error",
3524
"react/jsx-no-duplicate-props" : "error",
3625
"react/jsx-no-bind" : ["warn", { "ignoreDOMComponents" : true }],
3726
"react/jsx-pascal-case" : ["error", { "allowAllCaps" : true }],
38-
"react/jsx-props-no-multi-spaces" : "error",
3927
"react/no-access-state-in-setstate" : "error",
4028
"react/no-direct-mutation-state" : "error",
4129
"react/no-children-prop" : 1,
@@ -45,7 +33,6 @@
4533
"react/no-this-in-sfc" : "error",
4634
"react/no-typos": "error",
4735
"react/prop-types": [1, { "skipUndeclared" : true }],
48-
"semi": ["error", "always"],
4936
"valid-typeof" : ["error", { "requireStringLiterals": true }]
5037
},
5138
"env": {
@@ -56,22 +43,27 @@
5643
},
5744
"parser" : "@babel/eslint-parser",
5845
"extends": [
46+
"plugin:react/recommended",
5947
"eslint:recommended",
60-
"plugin:react/recommended"
48+
"prettier"
6149
],
6250
"parserOptions": {
6351
"ecmaVersion": 6,
6452
"sourceType": "module",
6553
"ecmaFeatures": {
6654
"jsx": true,
67-
"classes" : true
55+
"classes" : true,
56+
"modules": true
6857
}
6958
},
7059
"plugins": [
7160
"react",
72-
"cypress"
61+
"cypress",
62+
"prettier"
7363
],
7464
"overrides": [
65+
// Prettier isn't great at formatting these files, so we're skipping
66+
// them there; doing this here to prevent annoying squigglies
7567
{
7668
"files" : ["./src/encoded/static/data/*.jsx"],
7769
"rules" : {
@@ -80,5 +72,10 @@
8072
"react/react-in-jsx-scope" : 0
8173
}
8274
}
83-
]
84-
}
75+
],
76+
"settings": {
77+
"react": {
78+
"version": "detect"
79+
}
80+
}
81+
}

‎.prettierignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Ignore deps & build files
2+
/node_modules/
3+
/src/encoded/static/build/
4+
5+
# Ignore jsx static sections (overzealous about adding unnecessary semicolons)
6+
/docs/public/help/
7+
8+
# Also ignore that help doc for embedded search tables
9+
/src/encoded/static/data/embedded-search-table-demo.jsx

‎.prettierrc.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"bracketSameLine": true,
3+
"endOfLine": "lf",
4+
"singleQuote": true,
5+
"jsxSingleQuote": false,
6+
"tabs": true,
7+
"tabWidth": 4,
8+
"trailingComma": "es5"
9+
}

‎package-lock.json

+1,874-62
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
"cypress:open": "node_modules/.bin/cypress open --project './deploy/post_deploy_testing' --env Auth0Client=$Auth0Client,Auth0Secret=$Auth0Secret",
1313
"cypress:open-local": "node_modules/.bin/cypress open --project './deploy/post_deploy_testing' --env Auth0Client=$Auth0Client,Auth0Secret=$Auth0Secret --config baseUrl=http://localhost:8000",
1414
"cypress:test": "node_modules/.bin/cypress run --project './deploy/post_deploy_testing' --env Auth0Client=$Auth0Client,Auth0Secret=$Auth0Secret --config videoRecording=false",
15-
"cypress:test-recorded": "node_modules/.bin/cypress run --project './deploy/post_deploy_testing' --record --key $CYPRESS_KEY --env Auth0Client=$Auth0Client,Auth0Secret=$Auth0Secret"
15+
"cypress:test-recorded": "node_modules/.bin/cypress run --project './deploy/post_deploy_testing' --record --key $CYPRESS_KEY --env Auth0Client=$Auth0Client,Auth0Secret=$Auth0Secret",
16+
"format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx}\"",
17+
"lint": "eslint src --ext '.js,.jsx'",
18+
"lint:fix": "npm run lint -- --fix"
1619
},
1720
"author": "",
1821
"license": "MIT",
@@ -41,11 +44,15 @@
4144
"bootstrap": "^4.6.1",
4245
"bufferutil": "^4.0.7",
4346
"eslint": "^8.10.0",
47+
"eslint-config-prettier": "^8.8.0",
4448
"eslint-plugin-cypress": "^2.12.1",
49+
"eslint-plugin-prettier": "^4.2.1",
4550
"eslint-plugin-react": "^7.29.2",
4651
"fancy-log": "^1.3.3",
4752
"gulp": "^4.0.2",
4853
"plugin-error": "^1.0.1",
54+
"prettier": "^2.8.7",
55+
"prettier-eslint-cli": "^7.1.0",
4956
"sass": "^1.51.0",
5057
"sinon": "^1.17.6",
5158
"source-map-support": "^0.5.21",

0 commit comments

Comments
 (0)
Please sign in to comment.