Skip to content

Commit 00e3b8e

Browse files
authored
QZ-702 Rewrite and Upgrade Everything (#38)
Styles 2.0! * Documentation that explains how to use it * Handle deps using peerDependencies, which lets us extend them * Separate `eslint-config-react` from `eslint-config-base`: don't extend one from the other. This is consistent with the ESLint community. * Upgrade all deps * `@quartz/eslint-config-base`: * Nix `jest/no-disabled-tests`: it's in `jest/recommended` * Nix `jest/no-focused-tests`: it's in `jest/recommended` * Nix `jest/no-identical-title`: it's in `jest/recommended` * Nix `jest/valid-expect`: it's in `jest/recommended` * `@quartz/eslint-config-react`: * Extend `plugin:react/recommended` because hell yes * Nix `react/jsx-key`: it's in `react/recommended` * Nix `react/jsx-no-undef`: it's in `react/recommended` * Nix `react/jsx-uses-react`: it's in `react/recommended` * Nix `react/jsx-uses-vars`: it's in `react/recommended` * QZ-702 Add `react/function-component-definition` for consistency * Disable `react/prop-types` in TypeScript: TypeScript already checks prop types, and it's smarter.
1 parent 75326d9 commit 00e3b8e

File tree

8 files changed

+8776
-3492
lines changed

8 files changed

+8776
-3492
lines changed

README.md

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Linting
2+
3+
This project contains linting templates for Quartz projects. Currently, it
4+
contains:
5+
6+
- `@quartz/eslint-config-base`: Base ESLint config for JavaScript projects
7+
- `@quartz/eslint-config-react`: ESLint config for React projects
8+
- `.editorconfig`: EditorConfig for all projects
9+
10+
## Usage
11+
12+
### Installing in your Non-React project
13+
14+
In your shiny-new project (or the project you're retrofitting):
15+
16+
```
17+
npm install --save-dev \
18+
@quartz/eslint-config-base \
19+
@typescript-eslint/eslint-plugin \
20+
eslint \
21+
eslint-plugin-es \
22+
eslint-plugin-import \
23+
eslint-plugin-jest \
24+
jest
25+
```
26+
27+
And then use it in your ESLint config, e.g. in `.eslintrc`:
28+
29+
```
30+
{
31+
"extends": [
32+
"@quartz/eslint-config-base"
33+
]
34+
}
35+
```
36+
37+
### Installing in your React project
38+
39+
Yay! More dependencies!
40+
41+
```
42+
npm install --save-dev \
43+
@quartz/eslint-config-react \
44+
eslint-plugin-jsx-a11y \
45+
eslint-plugin-react \
46+
eslint-plugin-react-hooks
47+
```
48+
49+
And then add this to your ESLint config, like so:
50+
51+
```
52+
{
53+
"extends": [
54+
"@quartz/eslint-config-base",
55+
"@quartz/eslint-config-react"
56+
]
57+
}
58+
```
59+
60+
## Maintenance
61+
62+
Versions of these libraries are published to NPM.
63+
64+
### Testing changes before publishing
65+
66+
To test changes locally, clone this Git repo and then install the project(s)
67+
locally in your project -- e.g., in your `qz-react` directory:
68+
69+
```
70+
npm install --save-dev /path/to/lint/eslint-react
71+
```
72+
73+
See how that affects your project code. Talk it over with the team. And then:
74+
75+
1. Publish a new version of `@quartz/eslint-config-react`
76+
2. In your project, install the newly-published version (so the project doesn't
77+
expect stuff in the local filesystem).
78+
79+
### Publishing NPM modules
80+
81+
1. Make sure you have an [NPM account](https://npmjs.com) and it has been added
82+
to the `@quartz` organization.
83+
2. Log in to NPM: `npm login`
84+
3. Update the package version:
85+
```
86+
cd /path/to/my-package
87+
npm version [patch|minor|major]
88+
```
89+
4. Commit the version change.
90+
5. Make sure everything is correct! There is no undo!
91+
6. Publish the new version: `npm publish`
92+
7. Update the dependency in projects that use the package, e.g.:
93+
```
94+
cd /path/to/my-project-that-uses-my-package
95+
npm update --save-dev my-package@1.0.1
96+
```

eslint-base/index.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module.exports = {
6464
'error',
6565
{
6666
assertionStyle: 'never',
67-
}
67+
},
6868
],
6969

7070
'@typescript-eslint/no-extra-parens': [
@@ -178,14 +178,6 @@ module.exports = {
178178
},
179179
],
180180

181-
'jest/no-disabled-tests': 'error',
182-
183-
'jest/no-focused-tests': 'error',
184-
185-
'jest/no-identical-title': 'error',
186-
187-
'jest/valid-expect': 'error',
188-
189181
'key-spacing': [
190182
'error',
191183
{

0 commit comments

Comments
 (0)