Skip to content

Commit 1cd5270

Browse files
authored
Merge pull request #7 from daveseah/dev-ds/eslint-config
Prettier/ESLint Configuration Updates
2 parents 5ccb884 + 5686e55 commit 1cd5270

11 files changed

+7464
-23288
lines changed

.eslintrc-rules.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*///////////////////////////////// ABOUT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\
2+
3+
These are the specific overrides we use. It's imported in our
4+
.eslintrc.js file
5+
6+
\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/
7+
8+
const LINT_LEVEL = process.env.GS_LINT_LEVEL || 1;
9+
10+
/// RULE OVERRIDES ////////////////////////////////////////////////////////////
11+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12+
const URSYS_STYLE = {
13+
/* ursys style overrides */
14+
'spaced-comment': 'off',
15+
'camelcase': 'off',
16+
'comma-dangle': ['error', 'never'],
17+
'no-underscore-dangle': 'off',
18+
'lines-between-class-members': 'off',
19+
'no-bitwise': 'off',
20+
'import/prefer-default-export': 'off',
21+
'object-shorthand': 'off'
22+
};
23+
/* allow classroom debugging by researchers */
24+
const CLASSROOM = {
25+
'no-console': 'off',
26+
'no-debugger': 'warn',
27+
'no-alert': 'warn',
28+
'no-restricted-syntax': 'off'
29+
};
30+
/* turn off typescript recommendations */
31+
const HELP_TSJS = {
32+
'no-undef': 'off', // TS handles this better; works with global types
33+
'no-unused-vars': 'off',
34+
'no-shadow': 'off',
35+
'no-param-reassign': 'off',
36+
'object-curly-newline': 'off',
37+
'react/jsx-props-no-spreading': 'off',
38+
'arrow-body-style': 'off',
39+
'no-plusplus': 'off',
40+
'prefer-const': 'off',
41+
'prefer-destructuring': 'off',
42+
'class-methods-use-this': 'off',
43+
'jsx-a11y/label-has-associated-control': 'off'
44+
};
45+
/* disable rules for material-ui sanity */
46+
const YUCK_MUI = {
47+
'react/forbid-prop-types': 'off',
48+
'react/prop-types': 'off'
49+
};
50+
/* disable prettier conflicts manually */
51+
const YUCK_PRETTIER = {
52+
'arrow-parens': 'off'
53+
};
54+
/* these are our specific overrides of the recommended rules */
55+
const RULES = {
56+
...URSYS_STYLE,
57+
...CLASSROOM,
58+
...HELP_TSJS,
59+
...YUCK_MUI,
60+
...YUCK_PRETTIER
61+
};
62+
63+
/// EXPORTS ///////////////////////////////////////////////////////////////////
64+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
65+
module.exports = {
66+
RULES
67+
};

.eslintrc.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*///////////////////////////////// ABOUT \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*\
2+
3+
ESLINT CONFIGURATION for NETCREATE ITEST (2023)
4+
5+
\*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ * /////////////////////////////////////*/
6+
7+
const { RULES } = require('./.eslintrc-rules');
8+
9+
/// BASE CONFIGURATION ////////////////////////////////////////////////////////
10+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11+
const config = {
12+
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*:
13+
We want to support both node-style 'require' and es6 module 'import'.
14+
:*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
15+
env: {
16+
browser: true,
17+
es6: true,
18+
node: true
19+
},
20+
parserOptions: {
21+
'ecmaVersion': 2021,
22+
'sourceType': 'module'
23+
},
24+
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*:
25+
Plugins are packages that rules and sets of rules, but could also be
26+
something else (e.g. parser) that ESLINT can make use of.
27+
See: eslint.org/docs/user-guide/configuring#use-a-plugin
28+
:*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
29+
plugins: ['react'],
30+
extends: [
31+
'eslint:recommended', // standard recommendations
32+
'plugin:react/recommended', // handle jsx syntax
33+
'prettier' // prettier overrides
34+
],
35+
globals: {
36+
Atomics: 'readonly',
37+
SharedArrayBuffer: 'readonly'
38+
},
39+
settings: {
40+
'react': {
41+
'version': 'detect'
42+
}
43+
},
44+
/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*:
45+
The "rules" field can override what was set in the "extends" field.
46+
I am turning off the rules that I find annoying or trigger false warnings
47+
in some code structures.
48+
:*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
49+
rules: RULES
50+
};
51+
52+
/// EXPORTS ///////////////////////////////////////////////////////////////////
53+
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
54+
module.exports = config;

.eslintrc.json

Lines changed: 0 additions & 256 deletions
This file was deleted.

.prettierignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
module.exports = {
1010
semi: true,
11-
printWidth: 90,
11+
printWidth: 86,
1212
singleQuote: true,
1313
quoteProps: 'preserve',
1414
arrowParens: 'avoid',

0 commit comments

Comments
 (0)