@petbee/eslint-config 1.0.1-alpha-1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +37 -0
- package/index.js +74 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Petbee
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# `@petbee/prettier-config`
|
|
2
|
+
|
|
3
|
+
This package provides Petbees's `.prettierrc` shared config.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Give that you already have `prettier` installed, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
yarn add -D @petbee/prettier-config
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
After installing the module, add it to your `.prettierrc` configuration file:
|
|
16
|
+
|
|
17
|
+
```jsonc
|
|
18
|
+
"@petbee/prettier-config"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or add it to your `package.json`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
...
|
|
26
|
+
"prettier": "@petbee/prettier-config"
|
|
27
|
+
...
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Differently from `eslint`, `prettier` shared presets are not extensible, so if you want to override some property, which is not encouraged, you'll need to use the `.prettierrc.js` file.
|
|
32
|
+
|
|
33
|
+
For more information about configuring `prettier`, please check the [Prettier configuration documentation](https://prettier.io/docs/en/configuration.html).
|
|
34
|
+
|
|
35
|
+
## References
|
|
36
|
+
|
|
37
|
+
- [`prettier` options documentation](https://prettier.io/docs/en/options.html)
|
package/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
parser: '@typescript-eslint/parser',
|
|
3
|
+
parserOptions: {
|
|
4
|
+
project: 'tsconfig.json',
|
|
5
|
+
sourceType: 'module',
|
|
6
|
+
warnOnUnsupportedTypeScriptVersion: false,
|
|
7
|
+
},
|
|
8
|
+
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
9
|
+
extends: [
|
|
10
|
+
'plugin:@typescript-eslint/eslint-recommended',
|
|
11
|
+
'plugin:@typescript-eslint/recommended',
|
|
12
|
+
'plugin:react/recommended',
|
|
13
|
+
'prettier',
|
|
14
|
+
],
|
|
15
|
+
root: true,
|
|
16
|
+
env: {
|
|
17
|
+
node: true,
|
|
18
|
+
jest: true,
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
// Don't require a weird naming convention for interfaces
|
|
22
|
+
'@typescript-eslint/interface-name-prefix': 'off',
|
|
23
|
+
|
|
24
|
+
// Allow inferring types for functions
|
|
25
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
26
|
+
|
|
27
|
+
// Allow inferring types for exported things
|
|
28
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
29
|
+
|
|
30
|
+
// Don't allow "any" at all
|
|
31
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
32
|
+
|
|
33
|
+
// Make sure we are awaiting or explicitly voiding all Promises
|
|
34
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
|
35
|
+
|
|
36
|
+
// Allow using functions that are defined later in the file (fine thanks to hoisting)
|
|
37
|
+
'@typescript-eslint/no-use-before-define': [
|
|
38
|
+
'error',
|
|
39
|
+
{ functions: false, classes: false, variables: true },
|
|
40
|
+
],
|
|
41
|
+
|
|
42
|
+
// This rule makes no difference - ' and " are fine, > and } are already compile errors
|
|
43
|
+
'react/no-unescaped-entities': 'off',
|
|
44
|
+
|
|
45
|
+
// Disable validation of prop types, because we use TS instead and it gets confused
|
|
46
|
+
'react/prop-types': 'off',
|
|
47
|
+
|
|
48
|
+
// Make sure comments are starting with an uppercase letter, to encourage correct grammar
|
|
49
|
+
'capitalized-comments': [
|
|
50
|
+
'warn',
|
|
51
|
+
'always',
|
|
52
|
+
{
|
|
53
|
+
ignorePattern: 'prettier|c8',
|
|
54
|
+
ignoreConsecutiveComments: true,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
|
|
58
|
+
// Disable specific syntax features
|
|
59
|
+
'no-restricted-syntax': [
|
|
60
|
+
'error',
|
|
61
|
+
// Don't allow TS enums at all, since they have multiple unintuitive footguns
|
|
62
|
+
{
|
|
63
|
+
selector: 'TSEnumDeclaration',
|
|
64
|
+
message:
|
|
65
|
+
'Unexpected enum. Use a literal string union or a const object instead.',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
settings: {
|
|
70
|
+
react: {
|
|
71
|
+
version: 'detect',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@petbee/eslint-config",
|
|
3
|
+
"version": "1.0.1-alpha-1.0",
|
|
4
|
+
"description": "Petbee's eslint config",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint",
|
|
7
|
+
"config",
|
|
8
|
+
"petbee"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/petbee/typescript",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"main": "index.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/petbee/typescript.git",
|
|
19
|
+
"directory": "packages/eslint-config"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"format": "prettier --ignore-path='.gitignore' --list-different --write .",
|
|
23
|
+
"format:check": "prettier --ignore-path='.gitignore' --check .",
|
|
24
|
+
"lint": "eslint --ignore-path='.gitignore' '{src,tests}/**/*.{ts,tsx}'"
|
|
25
|
+
},
|
|
26
|
+
"eslintConfig": {
|
|
27
|
+
"extends": "./eslint-config.js"
|
|
28
|
+
},
|
|
29
|
+
"prettier": "@petbee/prettier-config",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/petbee/typescript/issues"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "6.10.0",
|
|
35
|
+
"@typescript-eslint/parser": "6.10.0",
|
|
36
|
+
"eslint-config-prettier": "9.0.0",
|
|
37
|
+
"eslint-plugin-react": "7.33.2"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"eslint": "^8.0.0",
|
|
41
|
+
"typescript": "^4.0.0 || ^5.0.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@petbee/prettier-config": "2.0.2",
|
|
45
|
+
"@types/react": "18.2.37",
|
|
46
|
+
"eslint": "8.53.0",
|
|
47
|
+
"prettier": "3.0.3",
|
|
48
|
+
"react": "18.2.0",
|
|
49
|
+
"typescript": "5.2.2"
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"gitHead": "c88132ca3b4e5269d65060a0f49ae7f2cbff9173"
|
|
55
|
+
}
|