@monkvision/eslint-config-typescript-react 4.0.7
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 +32 -0
- package/README.md +61 -0
- package/index.js +30 -0
- package/package.json +46 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
The Clear BSD License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2022] [Monk](http://monk.ai)
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted (subject to the limitations in the disclaimer
|
|
8
|
+
below) provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer.
|
|
12
|
+
|
|
13
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
14
|
+
notice, this list of conditions and the following disclaimer in the
|
|
15
|
+
documentation and/or other materials provided with the distribution.
|
|
16
|
+
|
|
17
|
+
* Neither the name of the copyright holder nor the names of its
|
|
18
|
+
contributors may be used to endorse or promote products derived from this
|
|
19
|
+
software without specific prior written permission.
|
|
20
|
+
|
|
21
|
+
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
|
|
22
|
+
THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
23
|
+
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
24
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
25
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
26
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
27
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
28
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
29
|
+
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
|
30
|
+
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
31
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
32
|
+
POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @monkvision/eslint-config-typescript-react
|
|
2
|
+
|
|
3
|
+
This package provides the base ESlint configuration used in MonkJs TypeScript React projects.
|
|
4
|
+
|
|
5
|
+
# Installation
|
|
6
|
+
|
|
7
|
+
To install this eslint configuration, simply run the following command :
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
yarn add -D @monkvision/eslint-config-typescript-react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Until ESlint flat config is implemented (_see the note below_), you will also need to install the required peer
|
|
14
|
+
dependencies.
|
|
15
|
+
|
|
16
|
+
# How to Use
|
|
17
|
+
|
|
18
|
+
To extend this config, simply place the following snipplet in your `.eslintrc.js` to include the config :
|
|
19
|
+
|
|
20
|
+
```javascript
|
|
21
|
+
module.exports = {
|
|
22
|
+
extends: ["@monkvision/eslint-config-typescript-react"],
|
|
23
|
+
parserOptions: {
|
|
24
|
+
project: ["./tsconfig.json"],
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Note that you need to manually specify the path to your tsconfig.json or the parser won't be able to locate your
|
|
30
|
+
Typescript config.
|
|
31
|
+
|
|
32
|
+
# A note reguarding ESlint Flat Configs
|
|
33
|
+
|
|
34
|
+
Due to the limitations of how ESlint works right now, shared ESlint configurations **need** to specify their
|
|
35
|
+
dependencies (such as other configs, plugins etc...) as peer dependencies. This forces developers that want to use our
|
|
36
|
+
config to manually download each one of our dependencies. This is obviously very cumbersome and kind of misses the whole
|
|
37
|
+
point of a shared config. This is even more true when it comes to monorepos. There are ways of bypassing this limitation
|
|
38
|
+
([@rushstack/eslint-patch](https://www.npmjs.com/package/@rushstack/eslint-patch) etc...) but they come with their own
|
|
39
|
+
limitations and are considered as "patches" rather than actual features.
|
|
40
|
+
|
|
41
|
+
However, in August 2022, the ESlint team came up with
|
|
42
|
+
[a new config system called ESlint Flat Config](https://eslint.org/blog/2022/08/new-config-system-part-1/). This new
|
|
43
|
+
config system allows (among other things) for a shared config to declare its dependencies as dev (or regular)
|
|
44
|
+
dependencies, and include them in the config file (by importing them as a node package). This is obviously great news
|
|
45
|
+
for us, since it basically means that all the issues listed in the previous paragraph will be solved. However, we need
|
|
46
|
+
to give time to ESlint configs and plugins packages to adapt to this new config system. For instance, the
|
|
47
|
+
typescript-eslint package created [an issue](https://github.com/typescript-eslint/typescript-eslint/issues/5938) on the
|
|
48
|
+
08/11 to update their config system.
|
|
49
|
+
|
|
50
|
+
This means that for now, we need to stick with the old config and its peer dependencies, and keep an eye on the package
|
|
51
|
+
updates until the new ESlint config system is mature enough for us to migrate to it.
|
|
52
|
+
|
|
53
|
+
Some references to read more about this subject :
|
|
54
|
+
|
|
55
|
+
- https://github.com/eslint/eslint/issues/3458
|
|
56
|
+
- https://eslint.org/blog/2022/08/new-config-system-part-1/
|
|
57
|
+
- https://eslint.org/blog/2022/08/new-config-system-part-2/
|
|
58
|
+
- https://eslint.org/blog/2022/08/new-config-system-part-3/
|
|
59
|
+
- https://github.com/eslint/eslint/issues/13481
|
|
60
|
+
- https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new
|
|
61
|
+
- https://github.com/typescript-eslint/typescript-eslint/issues/5938
|
package/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const OFF = 0;
|
|
2
|
+
const WARN = 1;
|
|
3
|
+
const ERROR = 2;
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
root: true,
|
|
7
|
+
extends: [
|
|
8
|
+
'@monkvision/eslint-config-typescript',
|
|
9
|
+
'plugin:jsx-a11y/recommended',
|
|
10
|
+
],
|
|
11
|
+
plugins: ['react', 'react-hooks', 'jsx-a11y'],
|
|
12
|
+
parser: '@typescript-eslint/parser',
|
|
13
|
+
rules: {
|
|
14
|
+
'no-console': ERROR,
|
|
15
|
+
'react/function-component-definition': [ERROR, { namedComponent: 'arrow-function' }],
|
|
16
|
+
'jsx-a11y/media-has-caption': OFF,
|
|
17
|
+
'jsx-a11y/anchor-has-content': OFF,
|
|
18
|
+
'jsx-a11y/anchor-is-valid': OFF,
|
|
19
|
+
'jsx-a11y/no-noninteractive-element-interactions': OFF,
|
|
20
|
+
},
|
|
21
|
+
ignorePatterns: ['**/*.js', 'node_modules', 'dist'],
|
|
22
|
+
overrides: [
|
|
23
|
+
{
|
|
24
|
+
files: ['test/**/*.{ts,tsx}'],
|
|
25
|
+
rules: {
|
|
26
|
+
'import/first': OFF,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@monkvision/eslint-config-typescript-react",
|
|
3
|
+
"packageManager": "yarn@3.2.4",
|
|
4
|
+
"version": "4.0.7",
|
|
5
|
+
"description": "The base ESLint config that used in MonkJs TypeScript React projects",
|
|
6
|
+
"author": "monkvision",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"license": "BSD-3-Clause-Clear",
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@monkvision/eslint-config-typescript": "*",
|
|
16
|
+
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
17
|
+
"eslint-plugin-react": "^7.27.1",
|
|
18
|
+
"eslint-plugin-react-hooks": "^4.3.0"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/monkvision/monkjs.git"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"monkvision",
|
|
29
|
+
"style guide",
|
|
30
|
+
"lint",
|
|
31
|
+
"eslint",
|
|
32
|
+
"config",
|
|
33
|
+
"es6",
|
|
34
|
+
"es2015",
|
|
35
|
+
"es2016",
|
|
36
|
+
"es2017",
|
|
37
|
+
"es2018",
|
|
38
|
+
"typescript",
|
|
39
|
+
"react"
|
|
40
|
+
],
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/monkvision/monkjs/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/monkvision/monkjs",
|
|
45
|
+
"gitHead": "f132e4e5bc390aa304e25a05f3f72f5e1dca6b13"
|
|
46
|
+
}
|