Skip to content

Commit 4f5dfa1

Browse files
Merge pull request #396 from monkvision/feature/mn-154-monkjs-4.0.0-init
Added MonkJs 4.0.0 directory
2 parents ad404fb + 5bf1033 commit 4f5dfa1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+15830
-4
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,3 @@ demo.dev.monk.yml
8484
# yarn
8585
.yarn/cache
8686
.yarn/install-state.gz
87-
88-
# refacto files
89-
demos
90-
packages/example

monkjs-4.0.0/.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

monkjs-4.0.0/.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.yarn/*
2+
!.yarn/patches
3+
!.yarn/plugins
4+
!.yarn/releases
5+
!.yarn/sdks
6+
!.yarn/versions
7+
8+
# Swap the comments on the following lines if you don't wish to use zero-installs
9+
# Documentation here: https://yarnpkg.com/features/zero-installs
10+
#!.yarn/cache
11+
.pnp.*
12+
13+
node_modules
14+
.idea

monkjs-4.0.0/.yarn/plugins/@yarnpkg/plugin-typescript.cjs

Lines changed: 9 additions & 0 deletions
Large diffs are not rendered by default.

monkjs-4.0.0/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Lines changed: 28 additions & 0 deletions
Large diffs are not rendered by default.

monkjs-4.0.0/.yarn/releases/yarn-3.2.4.cjs

Lines changed: 801 additions & 0 deletions
Large diffs are not rendered by default.

monkjs-4.0.0/.yarnrc.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
nodeLinker: node-modules
2+
3+
plugins:
4+
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
5+
spec: "@yarnpkg/plugin-workspace-tools"
6+
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
7+
spec: "@yarnpkg/plugin-typescript"
8+
9+
yarnPath: .yarn/releases/yarn-3.2.4.cjs

monkjs-4.0.0/LICENSE

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# @monkvision/eslint-config-react
2+
This package provides the base ESlint configuration for @monkvision Node.js packages that use React with Typescript.
3+
4+
# Installation
5+
To install this eslint configuration, simply run the following command :
6+
7+
```
8+
yarn add -D @monkvision/eslint-config-react
9+
```
10+
11+
If you are installing this package as a dev dependency in the @monkvision yarn workspace, you can add the following line
12+
in the dev dependencies of your package.json :
13+
14+
```
15+
"@monkvision/eslint-config-react": "workspace:*"
16+
```
17+
18+
Until ESlint flat config is implemented (*see the note below*), you will also need to install the required peer
19+
dependencies.
20+
21+
# How to Use
22+
To extend this config, simply place the following snipplet in your `.eslintrc.js` to include the config :
23+
24+
```javascript
25+
module.exports = {
26+
extends: ['@monkvision/eslint-config-react'],
27+
parserOptions: {
28+
project: ['./tsconfig.json'],
29+
},
30+
};
31+
```
32+
33+
Note that you need to manually specify the path to your tsconfig.json or the parser won't be able to locate your
34+
Typescript config.
35+
36+
# A note reguarding ESlint Flat Configs
37+
Due to the limitations of how ESlint works right now, shared ESlint configurations **need** to specify their
38+
dependencies (such as other configs, plugins etc...) as peer dependencies. This forces developers that want to use our
39+
config to manually download each and one of our dependencies. This is obviously very cumbersome and kind of misses the
40+
whole point of a shared config. This is even more true when it comes to monorepos like the official Monk repository, in
41+
which **every single package** has the same huge list of ESlint dependencies even though we have, right next to them, a
42+
single shared ESlint config. There are ways of bypassing this limitation
43+
([@rushstack/eslint-patch](https://www.npmjs.com/package/@rushstack/eslint-patch) etc...) but they come with their own
44+
limitations and are considered as "patches" rather than actual features.
45+
46+
However, in August 2022, the ESlint team came up with
47+
[a new config system called ESlint Flat Config](https://eslint.org/blog/2022/08/new-config-system-part-1/). This new
48+
config system allows (among other things) for a shared config to declare its dependencies as dev (or regular)
49+
dependencies, and include them in the config file (by importing them as a node package). This is obviously great news
50+
for us, since it basically means all of the issues listed in the previous paragraph will be solved. However, we need to
51+
give time to ESlint configs and plugins packages to adapt to this new config system, and for now. For instance, the
52+
typescript-eslint package created [an issue](https://github.com/typescript-eslint/typescript-eslint/issues/5938) on the
53+
08/11 to update their config system.
54+
55+
This means that for now, we need to stick with the old config and its peer dependencies, and keep an eye on the package
56+
updates until the new ESlint config system is mature enough for us to migrate to it.
57+
58+
Some references to read more about this subject :
59+
- https://github.com/eslint/eslint/issues/3458
60+
- https://eslint.org/blog/2022/08/new-config-system-part-1/
61+
- https://eslint.org/blog/2022/08/new-config-system-part-2/
62+
- https://eslint.org/blog/2022/08/new-config-system-part-3/
63+
- https://github.com/eslint/eslint/issues/13481
64+
- https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new
65+
- https://github.com/typescript-eslint/typescript-eslint/issues/5938
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const OFF = 0, WARN = 1, ERROR = 2;
2+
3+
module.exports = {
4+
extends: [
5+
'react-app',
6+
'react-app/jest',
7+
'airbnb',
8+
'airbnb/hooks',
9+
'plugin:promise/recommended',
10+
'plugin:import/errors',
11+
'plugin:import/warnings',
12+
'plugin:import/typescript',
13+
'plugin:@typescript-eslint/recommended',
14+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
15+
'plugin:prettier/recommended',
16+
],
17+
plugins: ['@typescript-eslint', 'jest', 'import', 'prettier'],
18+
parser: '@typescript-eslint/parser',
19+
settings: {
20+
'import/resolver': {
21+
node: {
22+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
23+
},
24+
},
25+
},
26+
rules: {
27+
'prettier/prettier': ERROR,
28+
'import/prefer-default-export': OFF,
29+
'import/extensions': OFF,
30+
'promise/always-return': OFF,
31+
'@typescript-eslint/lines-between-class-members': OFF,
32+
'no-plusplus' : [
33+
ERROR,
34+
{ allowForLoopAfterthoughts: true },
35+
],
36+
},
37+
overrides: [
38+
{
39+
files: ['*.ts', '*.tsx'],
40+
rules: {
41+
'@typescript-eslint/no-shadow': [ERROR],
42+
'no-shadow': OFF,
43+
'no-undef': OFF,
44+
},
45+
},
46+
{
47+
files: ['test/**/*.{ts,tsx}'],
48+
rules: {
49+
'import/first': OFF,
50+
},
51+
},
52+
],
53+
}

0 commit comments

Comments
 (0)