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
Update all linting subdependencies.
Add new rules, trigger, and enforce via tests.
Set defaults for some rules.
Add best practices and examples for managing linting in varying projects.
Release version 5.0.0.
Copy file name to clipboardExpand all lines: README.md
+91-4
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This is a shared configuration for all Tree repositories. Contains overrides and enhancements on top of the base configuration located at [https://github.com/fs-webdev/eslint-config-frontier](https://github.com/fs-webdev/eslint-config-frontier).
4
4
5
-
Utilizes the following plugins:
5
+
Why? Because we believe in linting, and we have become converted to the additional rules enforced by the following plugins:
@@ -55,10 +55,84 @@ Utilizes the following plugins:
55
55
56
56
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/)).
57
57
58
-
1. Set this simplified eslint configuration as the chosen config in your Code Climate's `plugins`: `eslint`: `config`: `config`.
58
+
1. Set this simplified eslint configuration as the chosen config in your Code Climate's `plugins`.
59
+
<pre><code>plugins:
60
+
eslint:
61
+
enabled: true
62
+
channel: "eslint-6"
63
+
config:
64
+
config: .codeclimate.eslintrc.js
65
+
extensions:
66
+
- .html
67
+
- .js
68
+
- .json
69
+
ignore_warnings: true
70
+
</code></pre>
59
71
60
72
1. Enjoy.
61
73
74
+
## HOWTOs:
75
+
76
+
### How to override linting rules for a directory and all of its contents:
77
+
78
+
Add an `eslintrc.js` file to that directory with the necessary overrides, like so:
### How to deal with `Definition for rule '{RULE}' was not found.` errors:
126
+
127
+
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 likely 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.
128
+
129
+
### How to do even trickier things with linting configuration:
130
+
131
+
Just read the manual: https://eslint.org/docs/7.0.0/user-guide/configuring
132
+
133
+
<details>
134
+
<summary>Maintenance Notes</summary>
135
+
62
136
## Testing/Updating:
63
137
64
138
Occasionally, there may be an update which breaks a rule in particular or linting in general. To this end, when running `npm test`, we output the current linting results to a text file, clean it up a little, and employ ava to run a snapshot comparison unit test to determine if our linting output has changed from the previous run.
@@ -67,14 +141,27 @@ If there has been a change (say you added a new rule, or there is a new valid vi
67
141
68
142
## Notes
69
143
144
+
- 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.
70
145
- 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.
71
-
- Coverage reporting ends up reporting on `lint-output.js`, instead of `index.js`, and so is also not used.
72
-
- 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.
146
+
- Coverage reporting ends up reporting on `lint-output.js`, instead of `index.js`, which is unhelpful, and so is also not used, for now.
147
+
148
+
</details>
73
149
74
150
## Changelog:
75
151
152
+
<details>
153
+
<summary>Version 5 </summary>
154
+
155
+
- Update all linting subdependencies.
156
+
- Add new rules.
157
+
- Set more reasonable defaults for some rules.
158
+
- Add best practices and examples for managing linting in varying projects.
159
+
160
+
</details>
161
+
76
162
<details>
77
163
<summary>Version 4 </summary>
164
+
78
165
-`eslint-plugin-no-only-tests` & `eslint-plugin-no-skip-tests` are redundant to to newly-implemented `jest/no-focused-tests` & `jest/no-disabled-tests` and have been removed.
// 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)
/* Example of a broken JS file that should trigger the additional rules contained in ./index.js */
2
2
3
+
/* eslint no-console: "off" -- node scripts use the console, so disable for the whole file */
4
+
3
5
/*
4
-
* Since developers have the ability to disable linting in-line, we keep track of the times where this is done.
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.
0 commit comments