README.md 1.45 KB
Newer Older
1
# @osufrlive/eslint-config
2
3
4
5
6

ESLint config for osu!frlive projects.

## Usage

7
8
9
Tested on npm 7+. Peer dependencies behavior change often in between major releases.

- Install as a development dependency:
10
```
11
npm i -D @osufrlive/eslint-config
12
13
```

14
- Paste in .eslintrc.js:
15
16
```javascript
module.exports = {
17
18
19
20
    root: true,
    extends: [
        "@osufrlive",
    ],
21
22
23
};
```

24
- Add the following script to `package.json`:
25
```json
26
27
28
29
30
31
"lint": "eslint --ext .js,.ts src/"
```

## Tip to allow linting entire repository

Files never included in the TypeScript context (such as .eslintrc.js) may error out with:
32
```
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/home/thepoon/Documents/git/osufrlive/form-auth/.eslintrc.js
  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: .eslintrc.js.
The file must be included in at least one of the projects provided
```

Suggested work-around:
- Create a new `tsconfig.eslint.json` file with:
```json
{
    "extends": "./tsconfig.json",
    "include": [
        ".eslintrc.js",
    ],
}
```
- Override `parserOptions.project` in `.eslintrc.js`, eg.:
```js
module.exports = {
    root: true,
    parserOptions: {
        project: ["./tsconfig.json", "./tsconfig.eslint.json"],
    },
    extends: [
        "@osufrlive",
    ],
};
```

## Upgrading

If upgrading from 0.0.x:  
- Remove any peer dependencies introduced by the package
- Remove the package
- Reinstall the package
- Update .eslintrc.js (see above)