@useinsider/eslint-config 0.0.1 → 1.0.0-alpha.2
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/README.md +85 -0
- package/package.json +48 -17
- package/src/config/README.md +56 -0
- package/src/dom/README.md +56 -0
- package/src/dom/index.cjs +19 -0
- package/src/node/README.md +56 -0
- package/src/node/index.cjs +18 -0
- package/src/rules/README.md +6 -0
- package/src/rules/{agnostic.cjs → core.cjs} +6 -3
- package/src/rules/stylistic.cjs +1 -0
- package/src/typescript/README.md +64 -0
- package/src/typescript/index.cjs +41 -0
- package/src/typescript-dom/README.md +64 -0
- package/src/{typescript.cjs → typescript-dom/index.cjs} +8 -7
- package/src/vue3/README.md +84 -0
- package/src/vue3/index.cjs +28 -0
- package/src/vue3-typescript/README.md +93 -0
- package/src/{vue3.cjs → vue3-typescript/index.cjs} +6 -6
- package/src/dom.cjs +0 -15
- package/src/node.cjs +0 -12
- /package/src/{config.cjs → config/index.cjs} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# ESLint Config
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
- [ESLint Config](#eslint-config)
|
|
5
|
+
- [Table of Contents](#table-of-contents)
|
|
6
|
+
- [Getting Started](#getting-started)
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Versioning Policy](#versioning-policy)
|
|
9
|
+
- [Available Configurations](#available-configurations)
|
|
10
|
+
- [Vanilla 🍦](#vanilla-)
|
|
11
|
+
- [Framework-specific](#framework-specific)
|
|
12
|
+
- [⏳ Upcoming Configurations](#-upcoming-configurations)
|
|
13
|
+
- [Contributing](#contributing)
|
|
14
|
+
|
|
15
|
+
## Getting Started
|
|
16
|
+
|
|
17
|
+
To ensure consistency and prevent version conflicts, we recommend adding this
|
|
18
|
+
library as a development dependency with a fixed version. This can be achieved
|
|
19
|
+
using the `-D` and `-E` flags in your package manager commands.
|
|
20
|
+
|
|
21
|
+
### Installation
|
|
22
|
+
|
|
23
|
+
1. **Install as a Development Dependency:**
|
|
24
|
+
- For npm users:
|
|
25
|
+
```bash
|
|
26
|
+
npm install -D -E @useinsider/eslint-config
|
|
27
|
+
```
|
|
28
|
+
- For pnpm users:
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add -D -E @useinsider/eslint-config
|
|
31
|
+
```
|
|
32
|
+
2. **Create an ESLint config file:**
|
|
33
|
+
You'll need an ESLint config file in your projects root directory.
|
|
34
|
+
|
|
35
|
+
You can check the official [ESLint documentation] to get more details.
|
|
36
|
+
3. **Extend the Configuration:**
|
|
37
|
+
Add the following to your `.eslintrc` file to extend the configuration:
|
|
38
|
+
```json5
|
|
39
|
+
{
|
|
40
|
+
"extends": ["@useinsider/eslint-config/dom"],
|
|
41
|
+
// Add the rest of your configuration here
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
[ESLint documentation]: https://eslint.org/docs/latest/use/configure/configuration-files
|
|
46
|
+
|
|
47
|
+
## Versioning Policy
|
|
48
|
+
|
|
49
|
+
This project follows the [Semantic Versioning](https://semver.org) policy.
|
|
50
|
+
|
|
51
|
+
## Available Configurations
|
|
52
|
+
|
|
53
|
+
We provide a variety of configurations to suit different environments and
|
|
54
|
+
frameworks. Here's a list of available configurations:
|
|
55
|
+
|
|
56
|
+
### Vanilla 🍦
|
|
57
|
+
|
|
58
|
+
| Environment | Browser (DOM) | Node |
|
|
59
|
+
| :---------------- | :------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------- |
|
|
60
|
+
| **EcmaScript/JS** | [`@useinsider/eslint-config/dom`](./src/dom#readme) | [`@useinsider/eslint-config`](./src/node#readme)<br>[`@useinsider/eslint-config/node`](./src/node#readme) |
|
|
61
|
+
| **TypeScript** | [`@useinsider/eslint-config/typescript-dom`](./src/typescript-dom#readme) | [`@useinsider/eslint-config/typescript`](./src/typescript#readme) |
|
|
62
|
+
| **Config files** | | [`@useinsider/eslint-config/config`](./src/config#readme) |
|
|
63
|
+
|
|
64
|
+
### Framework-specific
|
|
65
|
+
|
|
66
|
+
| Environment | JavaScript | TypeScript |
|
|
67
|
+
| :---------- | :---------------------------------------------------- | :-------------------------------------------------------------------------- |
|
|
68
|
+
| **Vue 3** | [`@useinsider/eslint-config/vue3`](./src/vue3#readme) | [`@useinsider/eslint-config/vue3-typescript`](./src/vue3-typescript#readme) |
|
|
69
|
+
|
|
70
|
+
### ⏳ Upcoming Configurations
|
|
71
|
+
|
|
72
|
+
Not available yet!
|
|
73
|
+
|
|
74
|
+
| Environment | Browser (DOM) | Node |
|
|
75
|
+
| :---------------- | :---------------------------------------------------------------- | :-------------------------------------------------------- |
|
|
76
|
+
| **Legacy ES5 💀** | [`@useinsider/eslint-config/legacy-dom`](./src/legacy-dom#readme) | [`@useinsider/eslint-config/legacy`](./src/legacy#readme) |
|
|
77
|
+
|
|
78
|
+
| Environment | JavaScript | TypeScript |
|
|
79
|
+
| :---------- | :---------------------------------------------------- | :-------------------------------------------------------------------------- |
|
|
80
|
+
| **Vue 2** | [`@useinsider/eslint-config/vue2`](./src/vue2#readme) | [`@useinsider/eslint-config/vue2-typescript`](./src/vue2-typescript#readme) |
|
|
81
|
+
|
|
82
|
+
## Contributing
|
|
83
|
+
|
|
84
|
+
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on
|
|
85
|
+
how to contribute to this project.
|
package/package.json
CHANGED
|
@@ -1,42 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/eslint-config",
|
|
3
|
+
"version": "1.0.0-alpha.2",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"useinsider",
|
|
6
|
+
"eslint",
|
|
7
|
+
"eslint-config"
|
|
8
|
+
],
|
|
3
9
|
"author": "Sahin Deniz <sahin.deniz@useinsider.com>",
|
|
4
10
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.1",
|
|
6
11
|
"packageManager": "pnpm@8.11.0",
|
|
7
12
|
"scripts": {
|
|
8
|
-
"lint": "eslint
|
|
13
|
+
"lint": "eslint ./",
|
|
14
|
+
"lint:ci": "pnpm lint --quiet",
|
|
9
15
|
"lint:fix": "pnpm lint --fix",
|
|
10
|
-
"release": "
|
|
16
|
+
"release": "semantic-release -e semantic-release-monorepo"
|
|
11
17
|
},
|
|
18
|
+
"homepage": "https://github.com/useinsider/eslint-config#readme",
|
|
12
19
|
"repository": {
|
|
13
20
|
"type": "git",
|
|
14
|
-
"url": "git+https://useinsider/eslint-config.git"
|
|
21
|
+
"url": "git+https://github.com/useinsider/eslint-config.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/useinsider/eslint-config/issues"
|
|
15
25
|
},
|
|
16
26
|
"exports": {
|
|
17
|
-
".": "./src/node.cjs",
|
|
18
|
-
"./
|
|
19
|
-
"./
|
|
20
|
-
"./
|
|
21
|
-
"./
|
|
22
|
-
"./
|
|
23
|
-
"./
|
|
27
|
+
".": "./src/node/index.cjs",
|
|
28
|
+
"./node": "./src/node/index.cjs",
|
|
29
|
+
"./config": "./src/config/index.cjs",
|
|
30
|
+
"./dom": "./src/dom/index.cjs",
|
|
31
|
+
"./typescript": "./src/typescript/index.cjs",
|
|
32
|
+
"./typescript-dom": "./src/typescript-dom/index.cjs",
|
|
33
|
+
"./vue3": "./src/vue3/index.cjs",
|
|
34
|
+
"./vue3-typescript": "./src/vue3-typescript/index.cjs"
|
|
24
35
|
},
|
|
25
36
|
"files": [
|
|
26
37
|
"src/**/*"
|
|
27
38
|
],
|
|
28
|
-
"
|
|
29
|
-
"
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": "^16.0.0 || >=18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@cspell/eslint-plugin": "6.19.2",
|
|
30
44
|
"@stylistic/eslint-plugin": "1.4.1",
|
|
31
45
|
"@stylistic/eslint-plugin-migrate": "1.4.1",
|
|
32
|
-
"@types/eslint": "8.44.7",
|
|
33
|
-
"@types/node": "20.10.1",
|
|
34
|
-
"eslint": "8.54.0",
|
|
35
46
|
"eslint-config-airbnb-base": "15.0.0",
|
|
36
47
|
"eslint-plugin-import": "2.29.0",
|
|
37
48
|
"eslint-plugin-jsdoc": "46.9.0"
|
|
38
49
|
},
|
|
39
50
|
"devDependencies": {
|
|
40
|
-
"
|
|
51
|
+
"@semantic-release/changelog": "6.0.3",
|
|
52
|
+
"@semantic-release/git": "10.0.1",
|
|
53
|
+
"@types/eslint": "8.44.8",
|
|
54
|
+
"@types/node": "20.10.2",
|
|
55
|
+
"@useinsider/release-config": "workspace:*",
|
|
56
|
+
"semantic-release": "19.0.5",
|
|
57
|
+
"semantic-release-monorepo": "7.0.5"
|
|
58
|
+
},
|
|
59
|
+
"optionalDependencies": {
|
|
60
|
+
"@rushstack/eslint-patch": ">=1.6.0",
|
|
61
|
+
"@stylistic/eslint-plugin": ">=1.4.1",
|
|
62
|
+
"@stylistic/eslint-plugin-migrate": ">=1.4.1",
|
|
63
|
+
"@typescript-eslint/eslint-plugin": ">=6.13.1",
|
|
64
|
+
"@vue/eslint-config-typescript": ">=12.0.0",
|
|
65
|
+
"eslint": ">=8.54.0",
|
|
66
|
+
"eslint-plugin-vue": ">=9.19.2",
|
|
67
|
+
"eslint-plugin-vue-scoped-css": ">=2.5.1",
|
|
68
|
+
"vue-eslint-parser": ">=9.3.2"
|
|
69
|
+
},
|
|
70
|
+
"publishConfig": {
|
|
71
|
+
"access": "restricted"
|
|
41
72
|
}
|
|
42
73
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @useinsider/eslint-config/config
|
|
2
|
+
|
|
3
|
+
This rule set specifically targets configuration files typically placed at the
|
|
4
|
+
root level of your project. These files are not part of your production build
|
|
5
|
+
but are crucial for maintaining consistent coding standards across your
|
|
6
|
+
development environment.
|
|
7
|
+
|
|
8
|
+
**Examples of such files include:**
|
|
9
|
+
- `.eslintrc.js`
|
|
10
|
+
- `vite.config.ts`
|
|
11
|
+
- `scripts/.../watch-build.js`
|
|
12
|
+
- ...and more.
|
|
13
|
+
|
|
14
|
+
## How to Use
|
|
15
|
+
|
|
16
|
+
To integrate these rules into your project, modify your `.eslintrc` file as
|
|
17
|
+
follows:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
/** @type {import("eslint").Linter.Config} */
|
|
21
|
+
module.exports = {
|
|
22
|
+
root: true,
|
|
23
|
+
overrides: [
|
|
24
|
+
{
|
|
25
|
+
// For JavaScript configuration files at root level
|
|
26
|
+
files: ['./*.js', './*.cjs'],
|
|
27
|
+
extends: [
|
|
28
|
+
'@useinsider/eslint-config',
|
|
29
|
+
'@useinsider/eslint-config/config',
|
|
30
|
+
],
|
|
31
|
+
// Add additional configurations here
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
{
|
|
35
|
+
// For TypeScript configuration files, including those in 'scripts' directory
|
|
36
|
+
files: ['./*.ts', './scripts/**/*.ts'],
|
|
37
|
+
extends: [
|
|
38
|
+
'@useinsider/eslint-config',
|
|
39
|
+
'@useinsider/eslint-config/typescript',
|
|
40
|
+
'@useinsider/eslint-config/config',
|
|
41
|
+
],
|
|
42
|
+
parserOptions: {
|
|
43
|
+
// Required for '@typescript-eslint/parser'
|
|
44
|
+
project: ['./tsconfig.json'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
<blockquote>
|
|
52
|
+
<p>[!NOTE]<br>
|
|
53
|
+
Ensure that the <code>parserOptions.project</code> path correctly points to
|
|
54
|
+
your <code>tsconfig.json</code> file to enable TypeScript linting.
|
|
55
|
+
</p>
|
|
56
|
+
</blockquote>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @useinsider/eslint-config/dom
|
|
2
|
+
|
|
3
|
+
This configuration is designed for production source files typically located in
|
|
4
|
+
the `src` directory of your project. It provides ESLint rules specifically for
|
|
5
|
+
DOM-related code.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Before proceeding, ensure you have ESLint installed in your project.
|
|
10
|
+
If not, install it:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add -E -D eslint
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -E -D eslint
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then, install the ESLint plugins that our configuration extends. These are
|
|
21
|
+
necessary for the configuration to work correctly:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add -E -D \
|
|
25
|
+
eslint-config-airbnb-base \
|
|
26
|
+
eslint-plugin-jsdoc \
|
|
27
|
+
@cspell/eslint-plugin
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -E -D \
|
|
32
|
+
eslint-config-airbnb-base \
|
|
33
|
+
eslint-plugin-jsdoc \
|
|
34
|
+
@cspell/eslint-plugin
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
To integrate these rules into your project, modify your `.eslintrc` file as
|
|
40
|
+
follows:
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
/** @type {import("eslint").Linter.Config} */
|
|
44
|
+
module.exports = {
|
|
45
|
+
root: true,
|
|
46
|
+
overrides: [
|
|
47
|
+
{
|
|
48
|
+
files: ['./src/**/*.js'],
|
|
49
|
+
extends: [
|
|
50
|
+
'@useinsider/eslint-config/dom',
|
|
51
|
+
],
|
|
52
|
+
// Add additional configuration settings as needed
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @type {import("eslint").Linter.Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
extends: [
|
|
4
|
+
require.resolve('../base.cjs'),
|
|
5
|
+
'airbnb-base',
|
|
6
|
+
'plugin:jsdoc/recommended',
|
|
7
|
+
'plugin:@cspell/recommended',
|
|
8
|
+
require.resolve('../rules/core.cjs'),
|
|
9
|
+
require.resolve('../rules/stylistic.cjs'),
|
|
10
|
+
require.resolve('../rules/jsdoc.cjs'),
|
|
11
|
+
],
|
|
12
|
+
env: {
|
|
13
|
+
browser: true,
|
|
14
|
+
es2021: true,
|
|
15
|
+
},
|
|
16
|
+
parserOptions: {
|
|
17
|
+
ecmaVersion: 'latest',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @useinsider/eslint-config/node
|
|
2
|
+
|
|
3
|
+
This ESLint configuration is ideal for Node.js projects without front-end
|
|
4
|
+
elements or DOM libraries. For mixed back-end and front-end projects, separate
|
|
5
|
+
override blocks or a combined `node` and `dom` setup in a single block are
|
|
6
|
+
possible, but not recommended.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Before proceeding, ensure you have ESLint installed in your project.
|
|
11
|
+
If not, install it:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add -E -D eslint
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -E -D eslint
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then, install the ESLint plugins that our configuration extends. These are
|
|
22
|
+
necessary for the configuration to work correctly:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add -E -D \
|
|
26
|
+
eslint-config-airbnb-base \
|
|
27
|
+
eslint-plugin-jsdoc \
|
|
28
|
+
@cspell/eslint-plugin
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -E -D \
|
|
33
|
+
eslint-config-airbnb-base \
|
|
34
|
+
eslint-plugin-jsdoc \
|
|
35
|
+
@cspell/eslint-plugin
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
To integrate these rules into your project, modify your `.eslintrc` file as
|
|
41
|
+
follows:
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
module.exports = {
|
|
45
|
+
root: true,
|
|
46
|
+
overrides: [
|
|
47
|
+
{
|
|
48
|
+
files: ['./src/**/*.{js,cjs,mjs}'],
|
|
49
|
+
extends: [
|
|
50
|
+
'@useinsider/eslint-config',
|
|
51
|
+
],
|
|
52
|
+
// Additional configuration here
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @type {import("eslint").Linter.Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
extends: [
|
|
4
|
+
require.resolve('../base.cjs'),
|
|
5
|
+
'airbnb-base',
|
|
6
|
+
'plugin:jsdoc/recommended',
|
|
7
|
+
'plugin:@cspell/recommended',
|
|
8
|
+
require.resolve('../rules/core.cjs'),
|
|
9
|
+
require.resolve('../rules/stylistic.cjs'),
|
|
10
|
+
require.resolve('../rules/jsdoc.cjs'),
|
|
11
|
+
],
|
|
12
|
+
env: {
|
|
13
|
+
node: true,
|
|
14
|
+
},
|
|
15
|
+
parserOptions: {
|
|
16
|
+
ecmaVersion: 'latest',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Rules
|
|
2
|
+
|
|
3
|
+
Each file contains only the rules that are specific to its name.
|
|
4
|
+
When a new plugin is introduced, its rule file must be named after the plugin
|
|
5
|
+
and it should only contain rules that are specific to it. Even if it suppresses
|
|
6
|
+
a core rule, oppressed rule must be declared inside the `core.cjs` file.
|
|
@@ -14,6 +14,8 @@ module.exports = {
|
|
|
14
14
|
'handle-callback-err': ['error'],
|
|
15
15
|
'import/extensions': ['error', {
|
|
16
16
|
js: 'never',
|
|
17
|
+
json: 'always',
|
|
18
|
+
jsx: 'never',
|
|
17
19
|
ts: 'never',
|
|
18
20
|
tsx: 'never',
|
|
19
21
|
vue: 'always',
|
|
@@ -120,18 +122,18 @@ module.exports = {
|
|
|
120
122
|
},
|
|
121
123
|
{
|
|
122
124
|
blankLine: 'always',
|
|
123
|
-
prev: ['*'],
|
|
124
125
|
next: ['multiline-block-like'],
|
|
126
|
+
prev: ['*'],
|
|
125
127
|
},
|
|
126
128
|
{
|
|
127
129
|
blankLine: 'always',
|
|
128
|
-
prev: ['multiline-block-like'],
|
|
129
130
|
next: ['*'],
|
|
131
|
+
prev: ['multiline-block-like'],
|
|
130
132
|
},
|
|
131
133
|
{
|
|
132
134
|
blankLine: 'any',
|
|
133
|
-
prev: ['case'],
|
|
134
135
|
next: ['case'],
|
|
136
|
+
prev: ['case'],
|
|
135
137
|
},
|
|
136
138
|
{
|
|
137
139
|
blankLine: 'any',
|
|
@@ -144,6 +146,7 @@ module.exports = {
|
|
|
144
146
|
}],
|
|
145
147
|
'prefer-destructuring': ['error'],
|
|
146
148
|
radix: ['error', 'as-needed'],
|
|
149
|
+
semi: 'off',
|
|
147
150
|
'space-before-function-paren': 'off',
|
|
148
151
|
strict: ['error'],
|
|
149
152
|
'use-isnan': ['error'],
|
package/src/rules/stylistic.cjs
CHANGED
|
@@ -53,6 +53,7 @@ module.exports = {
|
|
|
53
53
|
'@stylistic/multiline-ternary': ['error', 'always-multiline'],
|
|
54
54
|
'@stylistic/new-parens': ['error', 'always'],
|
|
55
55
|
'@stylistic/no-extra-parens': ['error', 'all', {
|
|
56
|
+
allowParensAfterCommentPattern: '@type',
|
|
56
57
|
enforceForArrowConditionals: false,
|
|
57
58
|
nestedBinaryExpressions: false,
|
|
58
59
|
returnAssign: false,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @useinsider/eslint-config/typescript
|
|
2
|
+
|
|
3
|
+
This ESLint configuration is ideal for Node.js projects without front-end
|
|
4
|
+
elements or DOM libraries. For mixed back-end and front-end projects, separate
|
|
5
|
+
override blocks or a combined `node` and `dom` setup in a single block are
|
|
6
|
+
possible, but not recommended.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Before proceeding, ensure you have ESLint installed in your project.
|
|
11
|
+
If not, install it:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add -E -D eslint
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -E -D eslint
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then, install the ESLint plugins that our configuration extends. These are
|
|
22
|
+
necessary for the configuration to work correctly:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add -E -D \
|
|
26
|
+
eslint-config-airbnb-base \
|
|
27
|
+
eslint-config-airbnb-typescript \
|
|
28
|
+
@cspell/eslint-plugin \
|
|
29
|
+
eslint-plugin-jsdoc \
|
|
30
|
+
@typescript-eslint/eslint-plugin
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install -E -D \
|
|
35
|
+
eslint-config-airbnb-base \
|
|
36
|
+
eslint-config-airbnb-typescript \
|
|
37
|
+
@cspell/eslint-plugin \
|
|
38
|
+
eslint-plugin-jsdoc \
|
|
39
|
+
@typescript-eslint/eslint-plugin
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
To integrate these rules into your project, modify your `.eslintrc` file as
|
|
45
|
+
follows:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
module.exports = {
|
|
49
|
+
root: true,
|
|
50
|
+
overrides: [
|
|
51
|
+
{
|
|
52
|
+
files: ['./src/**/*.ts'],
|
|
53
|
+
extends: [
|
|
54
|
+
'@useinsider/eslint-config/typescript',
|
|
55
|
+
],
|
|
56
|
+
parserOptions: {
|
|
57
|
+
// Required for '@typescript-eslint/parser'
|
|
58
|
+
project: ['./tsconfig.json'],
|
|
59
|
+
},
|
|
60
|
+
// Additional configuration here
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** @type {import("eslint").Linter.Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
extends: [
|
|
4
|
+
require.resolve('../base.cjs'),
|
|
5
|
+
'airbnb-base',
|
|
6
|
+
'airbnb-typescript/base',
|
|
7
|
+
'plugin:@cspell/recommended',
|
|
8
|
+
'plugin:jsdoc/recommended',
|
|
9
|
+
'plugin:jsdoc/recommended-typescript-error',
|
|
10
|
+
'plugin:@typescript-eslint/recommended',
|
|
11
|
+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
12
|
+
require.resolve('../rules/core.cjs'),
|
|
13
|
+
require.resolve('../rules/stylistic.cjs'),
|
|
14
|
+
require.resolve('../rules/jsdoc.cjs'),
|
|
15
|
+
require.resolve('../rules/typescript.cjs'),
|
|
16
|
+
],
|
|
17
|
+
env: {
|
|
18
|
+
node: true,
|
|
19
|
+
es2021: true,
|
|
20
|
+
},
|
|
21
|
+
plugins: ['@typescript-eslint'],
|
|
22
|
+
parser: '@typescript-eslint/parser',
|
|
23
|
+
parserOptions: {
|
|
24
|
+
ecmaVersion: 'latest',
|
|
25
|
+
sourceType: 'module',
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
'jsdoc/require-param': 'off',
|
|
29
|
+
'jsdoc/require-jsdoc': 'off',
|
|
30
|
+
'jsdoc/require-returns': 'off',
|
|
31
|
+
},
|
|
32
|
+
settings: {
|
|
33
|
+
jsdoc: {
|
|
34
|
+
mode: 'typescript',
|
|
35
|
+
tagNamePreference: {
|
|
36
|
+
callback: 'watch',
|
|
37
|
+
desc: 'use',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @useinsider/eslint-config/dom
|
|
2
|
+
|
|
3
|
+
This configuration is designed for production source files typically located in
|
|
4
|
+
the `src` directory of your project. It provides ESLint rules specifically for
|
|
5
|
+
DOM-related code.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Before proceeding, ensure you have ESLint installed in your project.
|
|
10
|
+
If not, install it:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pnpm add -E -D eslint
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -E -D eslint
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then, install the ESLint plugins that our configuration extends. These are
|
|
21
|
+
necessary for the configuration to work correctly:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add -E -D \
|
|
25
|
+
eslint-config-airbnb-base \
|
|
26
|
+
eslint-config-airbnb-typescript \
|
|
27
|
+
@cspell/eslint-plugin \
|
|
28
|
+
eslint-plugin-jsdoc \
|
|
29
|
+
@typescript-eslint/eslint-plugin
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -E -D \
|
|
34
|
+
eslint-config-airbnb-base \
|
|
35
|
+
eslint-config-airbnb-typescript \
|
|
36
|
+
@cspell/eslint-plugin \
|
|
37
|
+
eslint-plugin-jsdoc \
|
|
38
|
+
@typescript-eslint/eslint-plugin
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
To integrate these rules into your project, modify your `.eslintrc` file as
|
|
44
|
+
follows:
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
/** @type {import("eslint").Linter.Config} */
|
|
48
|
+
module.exports = {
|
|
49
|
+
root: true,
|
|
50
|
+
overrides: [
|
|
51
|
+
{
|
|
52
|
+
files: ['./src/**/*.ts'],
|
|
53
|
+
extends: [
|
|
54
|
+
'@useinsider/eslint-config/typescript-dom',
|
|
55
|
+
],
|
|
56
|
+
parserOptions: {
|
|
57
|
+
// `project` is necessary for `@typescript-eslint/parser` to work
|
|
58
|
+
project: ['./tsconfig.json'],
|
|
59
|
+
},
|
|
60
|
+
// Add additional configuration settings as needed
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
```
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/** @type {import("eslint").Linter.Config} */
|
|
2
2
|
module.exports = {
|
|
3
3
|
extends: [
|
|
4
|
-
require.resolve('
|
|
4
|
+
require.resolve('../base.cjs'),
|
|
5
|
+
'airbnb-base',
|
|
5
6
|
'airbnb-typescript/base',
|
|
6
|
-
'plugin:jsdoc/recommended',
|
|
7
7
|
'plugin:@cspell/recommended',
|
|
8
|
+
'plugin:jsdoc/recommended',
|
|
8
9
|
'plugin:jsdoc/recommended-typescript-error',
|
|
9
10
|
'plugin:@typescript-eslint/recommended',
|
|
10
11
|
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
11
|
-
require.resolve('
|
|
12
|
-
require.resolve('
|
|
13
|
-
require.resolve('
|
|
14
|
-
require.resolve('
|
|
12
|
+
require.resolve('../rules/core.cjs'),
|
|
13
|
+
require.resolve('../rules/stylistic.cjs'),
|
|
14
|
+
require.resolve('../rules/jsdoc.cjs'),
|
|
15
|
+
require.resolve('../rules/typescript.cjs'),
|
|
15
16
|
],
|
|
16
|
-
plugins: ['@typescript-eslint'],
|
|
17
17
|
env: {
|
|
18
18
|
browser: true,
|
|
19
19
|
es2021: true,
|
|
20
20
|
},
|
|
21
|
+
plugins: ['@typescript-eslint'],
|
|
21
22
|
parser: '@typescript-eslint/parser',
|
|
22
23
|
parserOptions: {
|
|
23
24
|
ecmaVersion: 'latest',
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @useinsider/eslint-config/vue3
|
|
2
|
+
|
|
3
|
+
This package provides a comprehensive ESLint configuration tailored for Vue 3
|
|
4
|
+
projects, ensuring code quality and consistency. It integrates best practices
|
|
5
|
+
from the Vue community and extends various ESLint plugins to cover aspects like
|
|
6
|
+
JSDoc conventions, and scoped CSS in Vue components.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Before proceeding, ensure you have ESLint installed in your project.
|
|
11
|
+
If not, install it:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add -E -D eslint
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -E -D eslint
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then, install the ESLint plugins and configurations that our Vue configuration
|
|
22
|
+
extends. These are necessary for the configuration to work correctly:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add -E -D \
|
|
26
|
+
eslint-config-airbnb-base \
|
|
27
|
+
eslint-plugin-vue \
|
|
28
|
+
eslint-plugin-vue-scoped-css \
|
|
29
|
+
eslint-plugin-jsdoc \
|
|
30
|
+
@cspell/eslint-plugin \
|
|
31
|
+
vue-eslint-parser
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -E -D \
|
|
36
|
+
eslint-config-airbnb-base \
|
|
37
|
+
eslint-plugin-vue \
|
|
38
|
+
eslint-plugin-vue-scoped-css \
|
|
39
|
+
eslint-plugin-jsdoc \
|
|
40
|
+
@cspell/eslint-plugin \
|
|
41
|
+
vue-eslint-parser
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
To use this ESLint configuration in your Vue 3 project, update your `.eslintrc`
|
|
47
|
+
file as follows:
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
/** @type {import("eslint").Linter.Config} */
|
|
51
|
+
module.exports = {
|
|
52
|
+
root: true,
|
|
53
|
+
overrides: [
|
|
54
|
+
{
|
|
55
|
+
files: ['./src/**/*.vue'],
|
|
56
|
+
extends: [
|
|
57
|
+
'@useinsider/eslint-config/vue3',
|
|
58
|
+
],
|
|
59
|
+
// Add additional configuration settings as needed
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Remember, you can always override specific rules or add additional plugins as
|
|
66
|
+
per your project's requirements.
|
|
67
|
+
|
|
68
|
+
## Reusable config limitation
|
|
69
|
+
|
|
70
|
+
Before [ESLint Flat Config] becomes stable, in order to work around a
|
|
71
|
+
[known limitation in ESLint], we recommend you to use this package alongside
|
|
72
|
+
[@rushstack/eslint-patch], so that you don't have to install too many
|
|
73
|
+
dependencies:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pnpm add -E -D @rushstack/eslint-patch
|
|
77
|
+
```
|
|
78
|
+
```bash
|
|
79
|
+
npm install -E -D @rushstack/eslint-patch
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
[ESLint Flat Config]: https://eslint.org/docs/latest/use/configure/configuration-files-new
|
|
83
|
+
[known limitation in ESLint]: https://github.com/eslint/eslint/issues/3458
|
|
84
|
+
[@rushstack/eslint-patch]: https://www.npmjs.com/package/@rushstack/eslint-patch
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @type {import("eslint").Linter.Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
extends: [
|
|
4
|
+
require.resolve('../base.cjs'),
|
|
5
|
+
'airbnb-base',
|
|
6
|
+
'plugin:vue/vue3-recommended',
|
|
7
|
+
'plugin:vue-scoped-css/vue3-recommended',
|
|
8
|
+
'plugin:jsdoc/recommended',
|
|
9
|
+
'plugin:@cspell/recommended',
|
|
10
|
+
require.resolve('../rules/core.cjs'),
|
|
11
|
+
require.resolve('../rules/stylistic.cjs'),
|
|
12
|
+
require.resolve('../rules/jsdoc.cjs'),
|
|
13
|
+
require.resolve('../rules/vue.cjs'),
|
|
14
|
+
],
|
|
15
|
+
env: {
|
|
16
|
+
browser: true,
|
|
17
|
+
es2021: true,
|
|
18
|
+
},
|
|
19
|
+
parser: 'vue-eslint-parser',
|
|
20
|
+
parserOptions: {
|
|
21
|
+
ecmaVersion: 'latest',
|
|
22
|
+
sourceType: 'module',
|
|
23
|
+
ecmaFeatures: {
|
|
24
|
+
jsx: true,
|
|
25
|
+
},
|
|
26
|
+
extraFileExtensions: ['.vue'],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @useinsider/eslint-config/vue3-typescript
|
|
2
|
+
|
|
3
|
+
This package provides a comprehensive ESLint configuration tailored for Vue 3
|
|
4
|
+
projects, ensuring code quality and consistency. It integrates best practices
|
|
5
|
+
from the Vue community and extends various ESLint plugins to cover aspects like
|
|
6
|
+
TypeScript support, JSDoc conventions, and scoped CSS in Vue components.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Before proceeding, ensure you have ESLint installed in your project.
|
|
11
|
+
If not, install it:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add -E -D eslint
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -E -D eslint
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then, install the ESLint plugins and configurations that our Vue configuration
|
|
22
|
+
extends. These are necessary for the configuration to work correctly:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add -E -D \
|
|
26
|
+
eslint-config-airbnb-base \
|
|
27
|
+
eslint-config-airbnb-typescript \
|
|
28
|
+
eslint-plugin-vue \
|
|
29
|
+
eslint-plugin-vue-scoped-css \
|
|
30
|
+
eslint-plugin-jsdoc \
|
|
31
|
+
@cspell/eslint-plugin \
|
|
32
|
+
@vue/eslint-config-typescript \
|
|
33
|
+
@typescript-eslint/eslint-plugin \
|
|
34
|
+
vue-eslint-parser
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install -E -D \
|
|
39
|
+
eslint-config-airbnb-base \
|
|
40
|
+
eslint-config-airbnb-typescript \
|
|
41
|
+
eslint-plugin-vue \
|
|
42
|
+
eslint-plugin-vue-scoped-css \
|
|
43
|
+
eslint-plugin-jsdoc \
|
|
44
|
+
@cspell/eslint-plugin \
|
|
45
|
+
@vue/eslint-config-typescript \
|
|
46
|
+
@typescript-eslint/eslint-plugin \
|
|
47
|
+
vue-eslint-parser
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
To use this ESLint configuration in your Vue 3 project, update your `.eslintrc`
|
|
53
|
+
file as follows:
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
/** @type {import("eslint").Linter.Config} */
|
|
57
|
+
module.exports = {
|
|
58
|
+
root: true,
|
|
59
|
+
overrides: [
|
|
60
|
+
{
|
|
61
|
+
files: ['./src/**/*.vue'],
|
|
62
|
+
extends: [
|
|
63
|
+
'@useinsider/eslint-config/vue3',
|
|
64
|
+
],
|
|
65
|
+
parserOptions: {
|
|
66
|
+
project: ['./tsconfig.json'],
|
|
67
|
+
},
|
|
68
|
+
// Add additional configuration settings as needed
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Remember, you can always override specific rules or add additional plugins as
|
|
75
|
+
per your project's requirements.
|
|
76
|
+
|
|
77
|
+
## Reusable config limitation
|
|
78
|
+
|
|
79
|
+
Before [ESLint Flat Config] becomes stable, in order to work around a
|
|
80
|
+
[known limitation in ESLint], we recommend you to use this package alongside
|
|
81
|
+
[@rushstack/eslint-patch], so that you don't have to install too many
|
|
82
|
+
dependencies:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pnpm add -E -D @rushstack/eslint-patch
|
|
86
|
+
```
|
|
87
|
+
```bash
|
|
88
|
+
npm install -E -D @rushstack/eslint-patch
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
[ESLint Flat Config]: https://eslint.org/docs/latest/use/configure/configuration-files-new
|
|
92
|
+
[known limitation in ESLint]: https://github.com/eslint/eslint/issues/3458
|
|
93
|
+
[@rushstack/eslint-patch]: https://www.npmjs.com/package/@rushstack/eslint-patch
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @type {import("eslint").Linter.Config} */
|
|
2
2
|
module.exports = {
|
|
3
3
|
extends: [
|
|
4
|
-
require.resolve('
|
|
4
|
+
require.resolve('../base.cjs'),
|
|
5
5
|
'airbnb-typescript/base',
|
|
6
6
|
'plugin:vue/vue3-recommended',
|
|
7
7
|
'plugin:vue-scoped-css/vue3-recommended',
|
|
@@ -10,11 +10,11 @@ module.exports = {
|
|
|
10
10
|
'plugin:@cspell/recommended',
|
|
11
11
|
'@vue/eslint-config-typescript',
|
|
12
12
|
'plugin:@typescript-eslint/recommended',
|
|
13
|
-
require.resolve('
|
|
14
|
-
require.resolve('
|
|
15
|
-
require.resolve('
|
|
16
|
-
require.resolve('
|
|
17
|
-
require.resolve('
|
|
13
|
+
require.resolve('../rules/core.cjs'),
|
|
14
|
+
require.resolve('../rules/stylistic.cjs'),
|
|
15
|
+
require.resolve('../rules/jsdoc.cjs'),
|
|
16
|
+
require.resolve('../rules/vue.cjs'),
|
|
17
|
+
require.resolve('../rules/typescript.cjs'),
|
|
18
18
|
],
|
|
19
19
|
plugins: ['@typescript-eslint'],
|
|
20
20
|
env: {
|
package/src/dom.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** @type {import("eslint").Linter.Config} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
extends: [
|
|
4
|
-
require.resolve('./base.cjs'),
|
|
5
|
-
'airbnb-base',
|
|
6
|
-
'plugin:jsdoc/recommended',
|
|
7
|
-
'plugin:@cspell/recommended',
|
|
8
|
-
require.resolve('./rules/agnostic.cjs'),
|
|
9
|
-
require.resolve('./rules/stylistic.cjs'),
|
|
10
|
-
require.resolve('./rules/jsdoc.cjs'),
|
|
11
|
-
],
|
|
12
|
-
env: {
|
|
13
|
-
browser: true,
|
|
14
|
-
},
|
|
15
|
-
};
|
package/src/node.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** @type {import("eslint").Linter.Config} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
extends: [
|
|
4
|
-
require.resolve('./base.cjs'),
|
|
5
|
-
'airbnb-base',
|
|
6
|
-
'plugin:jsdoc/recommended',
|
|
7
|
-
'plugin:@cspell/recommended',
|
|
8
|
-
require.resolve('./rules/agnostic.cjs'),
|
|
9
|
-
require.resolve('./rules/stylistic.cjs'),
|
|
10
|
-
require.resolve('./rules/jsdoc.cjs'),
|
|
11
|
-
],
|
|
12
|
-
};
|
|
File without changes
|