You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Major release: v6-alpha
Consume latest eslint-config-frontier-react.
Remove all Polymer-based, Code Climate-related, and legacy configuration and documentation.
Upgrade eslint to version 8.
Update snapshots to take all new rules into account.
Centralize all of our typical overrides (.ts, .stories, .test, etc.), and compartmentalize into its own `es6.js` file.
---------
Co-authored-by: Clif Bergmann <[email protected]>
// Basic .eslintrc.js file that loads the the frontier shared eslint configuration, and then the extension/override provided by the configuration in index.js just for local demonstration purposes. Also contains example `deprecate` rules.
2
-
module.exports={
3
-
extends: [
4
-
'eslint-config-frontier',
5
-
'eslint-config-standard',
6
-
// 'plugin:eslint-plugin-sonarjs/recommended' // Disabled globally, for now, because it is a much higher standard than Tree's existing code currently adheres to. Enable on a case-by-case basis, if you wish.
7
-
'plugin:promise/recommended',
8
-
'./index.js'
9
-
],
10
-
plugins: [
11
-
// Enable plugins that are not natively supported by Code Climate. Otherwise results in build errors.
12
-
'eslint-plugin-bestpractices',
13
-
'eslint-plugin-deprecate',
14
-
'eslint-plugin-promise',
15
-
'eslint-plugin-sonarjs',
16
-
'eslint-plugin-test-selectors'// NOTE: Only runs against JSX
17
-
],
18
-
rules: {
19
-
'deprecate/function': ['error',
20
-
{'name': 'deprecatedFunction','use': 'function x from package y'}
Copy file name to clipboardExpand all lines: README.md
+34-50
Original file line number
Diff line number
Diff line change
@@ -8,27 +8,30 @@ This central configuration is a potential breaking point for _all_ of our code i
8
8
9
9
**Process:**
10
10
11
+
1. Run `npm test` (to determine if any significant rules have changed since the last release)
12
+
- The tests will likely fail. Verify newly-consumed rules against the current [snapshot](/demo/test/snapshots/linting-config.test.js.md) file.
13
+
1. After verifying, run `npm run test:update`.
11
14
1. Make dependency/configuration updates.
12
-
1. Run `npm test`.
15
+
1. Run `npm test` (to determine new changes in linting results or configuration).
13
16
- The tests should likely fail. Verify your expectations against the current [snapshot](/demo/test/snapshots/linting-config.test.js.md) file.
14
17
1. After you have your results how you want them, run `npm run test:update`.
15
18
- The tests should now pass.
16
-
1. If you want see how your changes would impact a codebase, you can either `npm link` or copy+paste the contents of `local-linting-final-config.json` temporarily into the target `.eslintrc` file.
17
19
18
-
> TODO: Update the documentation below to be current, and not include things like Code Climate
20
+
<!--1. If you want see how your changes would impact a codebase, you can either `npm link` or copy+paste the contents of `local-linting-final-config.json` temporarily into the target `.eslintrc` file.
21
+
-->
19
22
20
23
Why extra rules? Because we believe in linting, and we have become converted to the additional rules enforced by the following plugins:
'eslint-config-frontier', // or '@fs/eslint-config-frontier-react'
52
52
'eslint-config-tree'
53
-
],
54
-
plugins: [
55
-
'eslint-plugin-bestpractices',
56
-
'eslint-plugin-deprecate',
57
-
'eslint-plugin-promise',
58
-
'eslint-plugin-sonarjs',
59
-
'eslint-plugin-test-selectors'
60
-
]
61
-
}</code></pre>
62
-
63
-
1. Add a `.codeclimate.eslintrc.js`
64
-
<pre><code>module.exports = {
65
-
extends: [
66
-
'./eslint-config-frontier.js', // or '@fs/eslint-config-frontier-react'
67
-
'./eslint-config-tree.js'
68
53
]
69
54
}</code></pre>
70
55
71
-
1. Add both `tree` and the frontier eslint configuration of your choice as Code Climate `prepare` resources (see: [extended eslint docs](https://www.familysearch.org/frontier/legacy/ui-components/eslint-config-frontier/)).
72
-
73
-
1. Set this simplified eslint configuration as the chosen config in your Code Climate's `plugins`.
74
-
<pre><code>plugins:
75
-
eslint:
76
-
enabled: true
77
-
channel: "eslint-6"
78
-
config:
79
-
config: .codeclimate.eslintrc.js
80
-
extensions:
81
-
- .html
82
-
- .js
83
-
- .json
84
-
ignore_warnings: true
85
-
</code></pre>
86
-
87
56
1. Enjoy.
88
57
89
58
## HOWTOs:
@@ -126,7 +95,7 @@ Utilize a file linting config modifier like so:
126
95
127
96
```
128
97
129
-
Note that `--` comments are permitted and a good idea to include.
98
+
Note that `--` comments are permitted and a very good idea to include.
130
99
131
100
<!--
132
101
DOES NOT CURRENTLY WORK, AND bestpractices/no-eslint-disable SHOULD PROBABLY BE MODIFIED TO TAKE THIS INTO ACCOUNT.
@@ -139,17 +108,13 @@ Or disable BOTH the desired rule and the no-eslint-disable rule:
139
108
140
109
### How to deal with `Definition for rule '{RULE}' was not found.` errors:
141
110
142
-
This is a known state when submitting a new file to Code Climate for the first time, since they do not support all of the linting extensions we wish to use. If you are seeing these warnings when linting locally, you may have `eslint` installed globally, but not the additional dependency. We do not recommend running `eslint` globally for this reason (see: https://github.com/eslint/eslint/issues/6732). All Tree repositories should include all dependencies required to be able to run `eslint` locally in their respective directories.
111
+
If you are seeing these warnings when linting locally, you may have `eslint` installed globally, but not the additional dependency. We do not recommend running `eslint` globally for this reason (see: https://github.com/eslint/eslint/issues/6732). All Tree repositories should include all dependencies required to be able to run `eslint` locally in their respective directories.
143
112
144
113
If you have recently updated dependencies and see this error locally, then there is a possibility that your editor's linting integration is out-of-sync that can be resolved by restarting your editor.
145
114
146
115
### How to not have tons of `jsdoc` warnings:
147
116
148
-
The `jsdoc` warnings are only triggered for functions that have an jsdoc extended comment block (`/** */`) directly above the function declaration. Omit this, or just use a short comment (`//`) or a standard extended comment (`/* */`) to keep from applying `jsdoc` rules to functions not requiring fastidious documentation. Or follow all of the rules.
149
-
150
-
### How to do even trickier things with linting configuration:
151
-
152
-
Just read the manual: https://eslint.org/docs/7.0.0/user-guide/configuring
117
+
The `jsdoc` warnings are only triggered for functions that have an jsdoc extended comment block (`/** */`) directly above the function declaration. Omit this, add an extra space, or just use a short comment (`//`) or a standard extended comment (`/* */`) to keep from applying `jsdoc` rules to functions not requiring fastidious documentation. Or follow all of the rules.
153
118
154
119
<details>
155
120
<summary>Maintenance Notes</summary>
@@ -162,14 +127,25 @@ If there has been a change (say you added a new rule, or there is a new valid vi
162
127
163
128
## Notes
164
129
130
+
- Why no lockfile? Because we (currently) trust our dependencies, and do not want to constantly have to be verifying and manually releasing new versions of this convenience configuration. We may decide to be more precise in the future.
165
131
- As noted in the `Testing/Updating` section, the only validation we do is to run linting against a file with a set of known failures. So we make sure to run `npm test` via a pre-push hook, and releases are automatically performed by a GitHub webhook.
166
-
- Because this is a public repository, there are complications in adding references to private services and communications channels, so there is no Travis CI build and no Code Climate integration.
132
+
- Because this is a public repository, there are complications in adding references to private services and communications channels, so there is no Travis CI build.
167
133
- Coverage reporting ends up reporting on `lint-output.js`, instead of `index.js`, which is unhelpful, and so is also not used, for now.
168
134
169
135
</details>
170
136
171
137
## Changelog:
172
138
139
+
<details>
140
+
<summary>Version 6 - ESLint 8</summary>
141
+
142
+
- Update all linting subdependencies. Remove redundant plugins (eslint-plugin-json adopted by Frontier).
143
+
- Remove Code Climate/Polymer-related configurations and documentation.
144
+
- Add new final configuration test.
145
+
- Inherit more configuration from frontier (finally).
146
+
147
+
</details>
148
+
173
149
<details>
174
150
<summary>Version 5 </summary>
175
151
@@ -200,3 +176,11 @@ If there has been a change (say you added a new rule, or there is a new valid vi
// Example directory override (still has access to all configuration, extensions, and plugins at the root level, but overrides the settings for this directory and below, if no other .eslintrc.js file exists)
2
-
// Common uses are to loosen our normally tight linting ruleset for code that is under development so that TODOs and the like do not crowd out more important warnings (provided that such overrides are removed upon production release)
3
1
module.exports={
4
2
rules: {
5
3
'bestpractices/no-eslint-disable': 'error',
6
-
'sonarjs/no-duplicated-branches': 'error'
7
-
}
8
-
};
4
+
'sonarjs/no-duplicated-branches': 'error',
5
+
'deprecate/function': ['error',{name: 'deprecatedFunction',use: 'function x from package y'}],
Copy file name to clipboardExpand all lines: demo/example.js
+48-47
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,8 @@
3
3
/* eslint no-console: "off" -- node scripts use the console, so disable for the whole file */
4
4
5
5
/*
6
-
* Since developers have the ability to disable linting in-line, we keep track of the times where this is done, because if done irresponsibly, this is a significant code smell.
7
-
*/
6
+
* Since developers have the ability to disable linting in-line, we keep track of the times where this is done, because if done irresponsibly, this is a significant code smell.
7
+
*/
8
8
// eslint-disable-next
9
9
10
10
// fixMe: Actually make this work
@@ -16,9 +16,9 @@
16
16
* As long as you separate the comment block from the declaration, JSDOC rules will not be applied. But the comment will still show through many IDE's definition hot-linking.
0 commit comments