Skip to content

Commit b27c9af

Browse files
authored
Merge pull request #191 from demvsystems/keep-configs-simple-add-vue
Adding vue package and updating other packages
2 parents 9472a5e + 1d6c5ae commit b27c9af

37 files changed

+1278
-1085
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ yarn-error.log*
2323
.env.production.local
2424

2525
.eslintcache
26+
.idea

.npmrc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
strict-peer-dependencies=false
2-
engine-strict=true
1+
auto-install-peers=true

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

README.md

Lines changed: 85 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,114 @@
55
## Whats included?
66
*the configuration is splitted into logical components so that you only have to include the things you need.*
77

8-
### liebe/base
9-
- eslint-config-airbnb-base
10-
- eslint-config-airbnb-typescript
11-
- eslint-import-resolver-typescript
12-
- eslint-plugin-eslint-comments
13-
- eslint-plugin-import
14-
- eslint-plugin-simple-import-sort
15-
- eslint-plugin-unicorn
16-
- eslint-plugin-promise
17-
- eslint-plugin-json
18-
- eslint-plugin-editorconfig
19-
20-
### liebe/testing
21-
- eslint-plugin-jest
22-
23-
### liebe/all
24-
- **Includes all the mentioned above**
8+
- @eslint-config-liebe/eslint-config-base
9+
- @eslint-config-liebe/eslint-config-jest
10+
- @eslint-config-liebe/eslint-config-vitest
11+
- @eslint-config-liebe/eslint-config-typescript
12+
- @eslint-config-liebe/eslint-config-vue
13+
2514

2615
## Installation
2716
In order to work around [a known limitation in ESLint](https://github.com/eslint/eslint/issues/3458), we recommend you to use this package alongside `@rushstack/eslint-patch`, so that you don't have to install too many dependencies:
2817
```sh
29-
npm i -D eslint-config-liebe@latest @rushstack/eslint-patch
18+
npm i -D @rushstack/eslint-patch
19+
```
3020

31-
or
21+
Eslint configs are installed with:
3222

33-
yarn add -D eslint-config-liebe@latest @rushstack/eslint-patch
23+
```shell
24+
npm i -D @eslint-config-liebe/eslint-config-base
25+
npm i -D @eslint-config-liebe/eslint-config-jest
26+
npm i -D @eslint-config-liebe/eslint-config-vitest
27+
npm i -D @eslint-config-liebe/eslint-config-typescript
28+
npm i -D @eslint-config-liebe/eslint-config-vue
3429
```
3530

3631
## Usage
3732

38-
Include the configs you need in your .eslintrc:
33+
Include the configs you need in your `.eslintrc` and link your local `tsconfig.json` in case of typescript. The order is important!
3934
```.eslintrc.js
4035
require("@rushstack/eslint-patch/modern-module-resolution")
4136

4237
module.exports = {
4338
extends: [
44-
'liebe/base',
45-
'liebe/testing',
39+
'@eslint-config-liebe/base',
40+
// '@eslint-config-liebe/jest',
41+
'@eslint-config-liebe/vitest',
42+
'@eslint-config-liebe/typescript',
43+
'@eslint-config-liebe/vue',
44+
],
45+
root: true,
46+
parserOptions: {
47+
project: 'tsconfig.json',
48+
},
49+
}
50+
```
51+
52+
Extend a tsconfig from either
53+
- @eslint-config-liebe/eslint-config-typescript
54+
- @eslint-config-liebe/eslint-config-vue
55+
56+
in your local `tsconfig.json`. `include`, `types`, `paths` and `baseUrl` are common properties which should be individually set.
57+
58+
```tsconfig.json
59+
{
60+
"extends": "./node_modules/@eslint-config-liebe/eslint-config-typescript/tsconfig.json",
61+
"compilerOptions": {
62+
"baseUrl": "./resources/js",
63+
"paths": {
64+
"@/*": [
65+
"*"
66+
]
67+
},
68+
"types": [
69+
"node",
70+
"vitest/globals",
71+
"vite/client",
72+
],
73+
},
74+
"include": [
75+
"resources/mix/*.js",
76+
"resources/js/**/*.js",
77+
"resources/js/**/*.ts",
78+
"resources/js/**/*.vue"
4679
]
4780
}
81+
4882
```
4983

50-
or just
84+
## Local development in other projects
5185

52-
```.eslintrc.js
53-
require("@rushstack/eslint-patch/modern-module-resolution")
86+
[yalc](https://github.com/wclr/yalc) can add your current state of `eslint-config-liebe` in another project to be tested there.
5487

55-
module.exports = {
56-
extends: [
57-
'liebe/all',
58-
]
59-
}
88+
In `eslint-config-liebe` project root run:
89+
90+
```shell
91+
yalc publish package/base
92+
yalc publish package/jest
93+
yalc publish package/vitest
94+
yalc publish package/typescript
95+
yalc publish package/vue
96+
```
97+
98+
In any local project root run to copy the package:
99+
100+
```shell
101+
yalc add @eslint-config-liebe/[email protected]
102+
yalc add @eslint-config-liebe/[email protected]
103+
yalc add @eslint-config-liebe/[email protected]
104+
yalc add @eslint-config-liebe/[email protected]
105+
yalc add @eslint-config-liebe/[email protected]
60106
```
61107

108+
You may run to install the added packages' dependencies:
109+
110+
```shell
111+
npm i # or similar
112+
```
113+
114+
Instead of `yalc add` there is `yalc link` to add a symbolic link rather then copying the package files.
115+
62116
## Changelog
63117
Please look at [CHANGELOG](CHANGELOG.md) or [Releases](https://github.com/Tjark-Kuehl/eslint-config-liebe/releases) for information on what has changed recently.
64118

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"commitlint": "17.6.3",
4242
"eslint": "8.40.0",
4343
"husky": "8.0.3",
44-
"semantic-release": "^20",
44+
"semantic-release": "^21.0.2",
4545
"semantic-release-monorepo": "7.0.5"
4646
},
4747
"packageManager": "[email protected]"

packages/base/rules/base.js renamed to packages/base/configs/base.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,18 @@ module.exports = {
66
// forces quotes around nearly everything, but keeps the option of writing numbers as object keys
77
// https://eslint.org/docs/rules/quote-props
88
'quote-props': ['error', 'consistent-as-needed', { keywords: false, unnecessary: true, numbers: false }],
9-
109
// disallow usage outside of loops for an easier unstanding of the code
1110
// https://eslint.org/docs/rules/no-plusplus
1211
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
13-
1412
// increases the max length of a line to 120 which seems more reasonable and ignores urls
1513
// https://eslint.org/docs/rules/max-len
16-
'max-len': ['error', { code: 120, ignoreUrls: true }],
17-
14+
'max-len': ['error', { code: 120, ignoreUrls: true, ignorePattern: '^import .*' }],
1815
// this just seems to be a legacy rule, disable it to force good variable names
1916
// https://eslint.org/docs/rules/no-underscore-dangle
2017
'no-underscore-dangle': 'error',
21-
2218
// disable because its handled by simple-import-sort
2319
// https://eslint.org/docs/rules/sort-imports
2420
'sort-imports': 'off',
25-
2621
// assignments on function parameters seem to be a really bad practise as it can create weird behavior
2722
// we enabled it for commonly used names in Array.reduce() tho, so we can still write it in a short way
2823
// https://eslint.org/docs/rules/no-param-reassign
@@ -41,7 +36,6 @@ module.exports = {
4136
],
4237
},
4338
],
44-
4539
// disallow declaration of variables that are not used in the code
4640
// https://eslint.org/docs/rules/no-unused-vars
4741
'no-unused-vars': [
@@ -52,24 +46,26 @@ module.exports = {
5246
ignoreRestSiblings: true,
5347
},
5448
],
55-
5649
// we dont want to disallow this rule because the code is way cleaner
5750
// however we would still advice to avoid this syntax
5851
// https://eslint.org/docs/rules/no-restricted-syntax
5952
'no-restricted-syntax': 'warn',
60-
6153
// too restrictive, writing ugly code to defend against a very unlikely scenario
6254
// https://eslint.org/docs/rules/no-prototype-builtins
6355
'no-prototype-builtins': 'off',
64-
6556
// use function hoisting to improve code readability
6657
// https://eslint.org/docs/rules/no-use-before-define
6758
'no-use-before-define': [
6859
'error',
6960
{ functions: false, classes: true, variables: true },
7061
],
71-
7262
// https://eslint.org/docs/rules/no-continue
7363
'no-continue': 'off',
64+
'object-curly-newline': ['error', {
65+
ObjectExpression: { minProperties: 10, multiline: true, consistent: true },
66+
ObjectPattern: { minProperties: 10, multiline: true, consistent: true },
67+
ImportDeclaration: { minProperties: 10, multiline: true, consistent: true },
68+
ExportDeclaration: { minProperties: 10, multiline: true, consistent: true },
69+
}],
7470
},
7571
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
extends: [
3+
'plugin:eslint-comments/recommended',
4+
],
5+
rules: {
6+
// Disabled as it's already covered by the `unicorn/no-abusive-eslint-disable` rule.
7+
'eslint-comments/no-unlimited-disable': 'off',
8+
'eslint-comments/disable-enable-pair': [
9+
'error',
10+
{
11+
allowWholeFile: true,
12+
},
13+
],
14+
},
15+
};

packages/base/rules/import.js renamed to packages/base/configs/import.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ module.exports = {
55
rules: {
66
// disable because its handled by simple-import-sort
77
'import/order': 'off',
8-
98
'import/no-anonymous-default-export': ['error', { allowObject: true }],
10-
119
'import/extensions': [
1210
'error',
1311
'never',
@@ -20,7 +18,6 @@ module.exports = {
2018
},
2119
},
2220
],
23-
2421
/**
2522
* We recommend you do not use the following rules, as TypeScript
2623
* provides the same checks as part of standard type checking
@@ -29,27 +26,15 @@ module.exports = {
2926
*/
3027
'import/named': 'off',
3128
'import/no-named-as-default-member': 'off',
32-
3329
// we agree with the opinion of basarat that the discoverability is poor
3430
// https://basarat.gitbook.io/typescript/main-1/defaultisbad
3531
'import/prefer-default-export': 'off',
3632
'import/no-default-export': 'error',
37-
38-
// we would prefer named exports over namespace exports
39-
// TODO: extract into different config due to bad performance
40-
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/namespace.md
33+
// we would prefer named exports over namespace exports, disabled due to performance
4134
'import/namespace': 'off',
42-
43-
// forbid cyclical dependencies between modules
44-
// TODO: extract into different config due to bad performance
35+
// forbid cyclical dependencies between modules, disabled due to performance
4536
// https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
46-
'import/no-cycle': [
47-
'off',
48-
{
49-
ignoreExternal: true,
50-
maxDepth: '∞',
51-
},
52-
],
37+
'import/no-cycle': 'off',
5338
},
5439
overrides: [
5540
{
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)