@kembec/eslint-config 1.0.2 → 1.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/.github/workflows/npm-publish.yaml +4 -5
- package/Readme.md +67 -31
- package/jest/index.js +11 -0
- package/package.json +2 -1
- package/rules/plugins.js +0 -8
- package/typescript/jest/index.js +11 -0
|
@@ -4,20 +4,19 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
|
-
pull_request:
|
|
8
|
-
branches:
|
|
9
|
-
- main
|
|
10
7
|
|
|
11
8
|
jobs:
|
|
12
9
|
npm-publish:
|
|
13
10
|
runs-on: ubuntu-latest
|
|
11
|
+
environment: NPM
|
|
14
12
|
steps:
|
|
15
13
|
- uses: actions/checkout@v3
|
|
16
14
|
- uses: actions/setup-node@v3
|
|
17
15
|
with:
|
|
18
|
-
node-version: '
|
|
16
|
+
node-version: '16'
|
|
17
|
+
registry-url: 'https://registry.npmjs.org/'
|
|
19
18
|
- run: npm install
|
|
20
|
-
- run: npm
|
|
19
|
+
- run: npm run build --if-present
|
|
21
20
|
- uses: JS-DevTools/npm-publish@v1
|
|
22
21
|
with:
|
|
23
22
|
token: ${{ secrets.TOKEN_NPM }}
|
package/Readme.md
CHANGED
|
@@ -1,40 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Streamlined ESLint Configuration for JS/TS Projects
|
|
2
2
|
|
|
3
|
+
This document outlines the steps to integrate my ESLint setup into your JavaScript or TypeScript projects. It's a personal collection of configurations and plugins aimed at fostering a consistent coding style and catching common errors.
|
|
3
4
|
|
|
4
|
-
##
|
|
5
|
+
## Quick Start Guide
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
npm install -D @kembec/eslint-config
|
|
9
|
-
```
|
|
7
|
+
### Step 1: Installation
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
Add the configuration package to your development dependencies:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -D @kembec/eslint-config
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Step 2: Configure ESLint
|
|
16
|
+
|
|
17
|
+
Modify your ESLint configuration file to use this package. The setup varies slightly depending on whether you're working with plain JavaScript or TypeScript.
|
|
18
|
+
|
|
19
|
+
- **For JavaScript Projects**: In your `.eslintrc` (which could be a `.json`, `.js`, or `.ts` file), include the following:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"extends": ["@kembec/eslint-config"]
|
|
24
|
+
// Include Jest
|
|
25
|
+
"extends": ["@kembec/eslint-config/jest"]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- **For TypeScript Projects**: To incorporate TypeScript-specific rules and configure the parser options, use this setup:
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"extends": ["@kembec/eslint-config/typescript"],
|
|
34
|
+
// Include Jest
|
|
35
|
+
"extends": ["@kembec/eslint-config/typescript/jest"]
|
|
36
|
+
"overrides": [
|
|
18
37
|
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
parserOptions: {
|
|
24
|
-
project: ["./tsconfig.json"],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
]
|
|
38
|
+
"files": ["*.ts", "*.tsx"],
|
|
39
|
+
"parserOptions": {
|
|
40
|
+
"project": ["./tsconfig.json"]
|
|
41
|
+
}
|
|
28
42
|
}
|
|
29
|
-
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Included Plugins
|
|
48
|
+
|
|
49
|
+
The configuration incorporates a carefully selected set of ESLint plugins to assist with various code quality and style concerns:
|
|
50
|
+
|
|
51
|
+
- `eslint-plugin-import`: Manages and validates import statements.
|
|
52
|
+
- `eslint-plugin-jest`: Provides linting rules for Jest tests.
|
|
53
|
+
- `eslint-plugin-prettier`: Integrates Prettier formatting into ESLint.
|
|
54
|
+
- `eslint-plugin-simple-import-sort`: Automatically sorts import statements.
|
|
55
|
+
- `eslint-plugin-unused-imports`: Helps in removing unused imports.
|
|
56
|
+
- `@typescript-eslint/eslint-plugin`: Adds TypeScript-specific linting rules.
|
|
57
|
+
- `@typescript-eslint/parser`: Allows ESLint to parse TypeScript code.
|
|
58
|
+
|
|
59
|
+
These plugins are intended to help maintain a clean codebase and promote coding best practices.
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
Integrate linting into your workflow with these npm scripts:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
"scripts": {
|
|
67
|
+
"lint": "eslint .",
|
|
68
|
+
"lint:fix": "eslint --fix ."
|
|
69
|
+
}
|
|
70
|
+
```
|
|
30
71
|
|
|
72
|
+
Use `npm run lint` to identify issues or `npm run lint:fix` to fix many issues automatically.
|
|
31
73
|
|
|
32
|
-
##
|
|
74
|
+
## License
|
|
33
75
|
|
|
34
|
-
|
|
35
|
-
- eslint-plugin-jest
|
|
36
|
-
- eslint-plugin-prettier
|
|
37
|
-
- eslint-plugin-simple-import-sort
|
|
38
|
-
- eslint-plugin-unused-import
|
|
39
|
-
- @typescript-eslint/eslint-plugin
|
|
40
|
-
- @typescript-eslint/parser
|
|
76
|
+
`Sunat Utils` is licensed under the [AGPL-3.0](https://opensource.org/licenses/AGPL-3.0). Its use, modification, and distribution are allowed under the terms of this license.
|
package/jest/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kembec/eslint-config",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "My personal linter configuration for JavaScript/TypeScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"eslint",
|
|
18
18
|
"lint",
|
|
19
19
|
"prettier",
|
|
20
|
+
"jest",
|
|
20
21
|
"kembec"
|
|
21
22
|
],
|
|
22
23
|
"author": "Kembec.com",
|
package/rules/plugins.js
CHANGED