@msobiecki/eslint-config 8.9.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/.eslintrc.json +6 -0
- package/.github/dependabot.yml +11 -0
- package/.github/workflows/dependabot-auto-merge.yml +26 -0
- package/.github/workflows/release-publish.yml +63 -0
- package/.husky/commit-msg +1 -0
- package/.husky/pre-commit +1 -0
- package/.lintstagedrc +8 -0
- package/CHANGELOG.md +20 -0
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/best-practice.js +3 -0
- package/commitlint.config.js +1 -0
- package/index.js +3 -0
- package/jest-dom.js +3 -0
- package/jest-react.js +3 -0
- package/jest.js +3 -0
- package/next.js +3 -0
- package/node.js +3 -0
- package/package.json +64 -0
- package/presets/base/base.js +18 -0
- package/presets/best-practice/best-practice.js +23 -0
- package/presets/jest/jest-base.js +8 -0
- package/presets/jest/jest-dom.js +9 -0
- package/presets/jest/jest-react.js +8 -0
- package/presets/next/next.js +3 -0
- package/presets/node/node.js +3 -0
- package/presets/react/react-jsx.js +3 -0
- package/presets/react/react.js +27 -0
- package/react-jsx.js +3 -0
- package/react.js +3 -0
- package/utils/get-ts-config.js +11 -0
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "npm" # See documentation for possible values
|
|
9
|
+
directory: "/" # Location of package manifests
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Dependabot auto-merge
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
branches:
|
|
5
|
+
- master
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: write
|
|
9
|
+
pull-requests: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
dependabot:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
if: github.actor == 'dependabot[bot]'
|
|
15
|
+
steps:
|
|
16
|
+
- name: Dependabot metadata
|
|
17
|
+
id: metadata
|
|
18
|
+
uses: dependabot/fetch-metadata@v2
|
|
19
|
+
with:
|
|
20
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
21
|
+
- name: Enable auto-merge for Dependabot PRs
|
|
22
|
+
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
|
|
23
|
+
run: gh pr merge --auto --squash "$PR_URL"
|
|
24
|
+
env:
|
|
25
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
|
26
|
+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Release publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master ]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
packages: write
|
|
13
|
+
contents: write
|
|
14
|
+
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
node-version: [18.x]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
23
|
+
uses: actions/setup-node@v4
|
|
24
|
+
env:
|
|
25
|
+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
26
|
+
with:
|
|
27
|
+
node-version: ${{ matrix.node-version }}
|
|
28
|
+
registry-url: https://npm.pkg.github.com
|
|
29
|
+
scope: "@msobiecki"
|
|
30
|
+
|
|
31
|
+
- name: Run version bump
|
|
32
|
+
id: changelog
|
|
33
|
+
uses: TriPSs/conventional-changelog-action@v5.2.1
|
|
34
|
+
with:
|
|
35
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
36
|
+
skip-on-empty: false
|
|
37
|
+
|
|
38
|
+
- name: Run release
|
|
39
|
+
uses: actions/create-release@v1
|
|
40
|
+
env:
|
|
41
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
42
|
+
with:
|
|
43
|
+
tag_name: ${{ steps.changelog.outputs.tag }}
|
|
44
|
+
release_name: ${{ steps.changelog.outputs.tag }}
|
|
45
|
+
body: ${{ steps.changelog.outputs.clean_changelog }}
|
|
46
|
+
|
|
47
|
+
- name: Install dependencies
|
|
48
|
+
run: npm ci
|
|
49
|
+
env:
|
|
50
|
+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
51
|
+
|
|
52
|
+
- name: Run publish
|
|
53
|
+
uses: JS-DevTools/npm-publish@v3
|
|
54
|
+
with:
|
|
55
|
+
registry: https://npm.pkg.github.com/
|
|
56
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
57
|
+
|
|
58
|
+
- name: Run publish to NPMjs
|
|
59
|
+
uses: JS-DevTools/npm-publish@v3
|
|
60
|
+
with:
|
|
61
|
+
registry: https://registry.npmjs.org/
|
|
62
|
+
token: ${{ secrets.NPM_TOKEN }}
|
|
63
|
+
access: public
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx commitlint --edit "$1"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
package/.lintstagedrc
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
## [8.9.7](https://github.com/msobiecki/eslint-config/compare/v8.9.6...v8.9.7) (2024-11-24)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## [8.9.6](https://github.com/msobiecki/eslint-config/compare/v8.9.5...v8.9.6) (2024-11-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [8.9.5](https://github.com/msobiecki/eslint-config/compare/v8.9.4...v8.9.5) (2024-11-22)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [8.9.4](https://github.com/msobiecki/eslint-config/compare/v8.9.3...v8.9.4) (2024-11-11)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [8.9.3](https://github.com/msobiecki/eslint-config/compare/v8.9.2...v8.9.3) (2024-11-11)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Michał Sobiecki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# eslint-config
|
|
2
|
+
|
|
3
|
+
[](https://github.com/msobiecki/eslint-config/blob/master/LICENSE)
|
|
4
|
+
|
|
5
|
+
Custom ESLint configuration for projects. It extends popular Airbnb ESLint config and other popular configs in one place.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Usage](#usage)
|
|
11
|
+
- [License](#license)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install --save-dev @msobiecki/eslint-config
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Make sure to install the necessary peer dependencies as well:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install --save-dev eslint prettier
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
To use this ESLint configuration, you need to extend it in your project's `.eslintrc` file:
|
|
28
|
+
|
|
29
|
+
### base javascript/typescript configuration
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"extends": "@msobiecki/eslint-config"
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### react javascript/typescript configuration
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"extends": [
|
|
42
|
+
"@msobiecki/eslint-config/react",
|
|
43
|
+
"@msobiecki/eslint-config/react-jsx"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### next configuration
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"extends": ["@msobiecki/eslint-config/next"]
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### node configuration
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"extends": ["@msobiecki/eslint-config/node"]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### jest configuration
|
|
65
|
+
|
|
66
|
+
#### base
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"extends": ["@msobiecki/eslint-config/jest"]
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### dom
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"extends": [
|
|
79
|
+
"@msobiecki/eslint-config/jest",
|
|
80
|
+
"@msobiecki/eslint-config/jest-dom"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### react
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"extends": [
|
|
90
|
+
"@msobiecki/eslint-config/jest",
|
|
91
|
+
"@msobiecki/eslint-config/jest-react"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### best practice configuration
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"extends": ["@msobiecki/eslint-config/best-practice"]
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
If you have an existing ESLint configuration, you can merge it with this configuration using the `extends` property:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"extends": ["@msobiecki/eslint-config", "your-existing-config"]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
Feel free to contribute to this repository by opening issues or submitting pull requests. Happy coding!
|
package/best-practice.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = { extends: ["@commitlint/config-conventional"] };
|
package/index.js
ADDED
package/jest-dom.js
ADDED
package/jest-react.js
ADDED
package/jest.js
ADDED
package/next.js
ADDED
package/node.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@msobiecki/eslint-config",
|
|
3
|
+
"version": "8.9.7",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "An ESLint shareable config for JavaScript/TypeScript ecosystem's.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"eslint",
|
|
8
|
+
"eslint-config"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/msobiecki/eslint-config/",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/msobiecki/eslint-config/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"url": "git://git@github.com:msobiecki/eslint-config.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Michał Sobiecki <kontakt@codeshaker.pl>",
|
|
19
|
+
"main": "index.js",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"prepare": "husky install"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
25
|
+
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
26
|
+
"eslint-config-next": "^15.0.3",
|
|
27
|
+
"eslint-config-prettier": "^9.1.0",
|
|
28
|
+
"eslint-plugin-compat": "^6.0.1",
|
|
29
|
+
"eslint-plugin-deprecation": "^3.0.0",
|
|
30
|
+
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
31
|
+
"eslint-plugin-import": "^2.31.0",
|
|
32
|
+
"eslint-plugin-jest": "^28.9.0",
|
|
33
|
+
"eslint-plugin-jest-dom": "^5.5.0",
|
|
34
|
+
"eslint-plugin-jsdoc": "^50.5.0",
|
|
35
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
36
|
+
"eslint-plugin-n": "^17.13.2",
|
|
37
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
38
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
39
|
+
"eslint-plugin-react": "^7.37.2",
|
|
40
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
41
|
+
"eslint-plugin-security": "^3.0.1",
|
|
42
|
+
"eslint-plugin-storybook": "^0.11.0",
|
|
43
|
+
"eslint-plugin-testing-library": "^6.4.0",
|
|
44
|
+
"eslint-plugin-unicorn": "^56.0.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@commitlint/cli": "^19.5.0",
|
|
48
|
+
"@commitlint/config-conventional": "^19.5.0",
|
|
49
|
+
"eslint": "^8.57.1",
|
|
50
|
+
"husky": "^9.1.6",
|
|
51
|
+
"lint-staged": "^15.2.10",
|
|
52
|
+
"prettier": "^3.3.3"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"eslint": "^8.0.0",
|
|
56
|
+
"prettier": "^3.0.0"
|
|
57
|
+
},
|
|
58
|
+
"overrides": {
|
|
59
|
+
"eslint-config-next": {
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
61
|
+
"@typescript-eslint/parser": "^7.0.0"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const getTsConfig = require("../../utils/get-ts-config");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
extends: ["airbnb-base"],
|
|
5
|
+
overrides: [
|
|
6
|
+
{
|
|
7
|
+
files: ["**/*.ts"],
|
|
8
|
+
extends: [
|
|
9
|
+
"airbnb-typescript/base",
|
|
10
|
+
"plugin:@typescript-eslint/recommended",
|
|
11
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
12
|
+
],
|
|
13
|
+
parserOptions: {
|
|
14
|
+
project: getTsConfig(),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: [
|
|
3
|
+
"plugin:promise/recommended",
|
|
4
|
+
"plugin:unicorn/recommended",
|
|
5
|
+
"plugin:security/recommended-legacy",
|
|
6
|
+
"plugin:jsdoc/recommended",
|
|
7
|
+
"plugin:eslint-comments/recommended",
|
|
8
|
+
"plugin:compat/recommended",
|
|
9
|
+
"plugin:prettier/recommended",
|
|
10
|
+
],
|
|
11
|
+
rules: {
|
|
12
|
+
"unicorn/prefer-module": ["off"],
|
|
13
|
+
},
|
|
14
|
+
overrides: [
|
|
15
|
+
{
|
|
16
|
+
files: ["**/*.ts?(x)"],
|
|
17
|
+
extends: [
|
|
18
|
+
"plugin:jsdoc/recommended-typescript",
|
|
19
|
+
"plugin:deprecation/recommended",
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const getTsConfig = require("../../utils/get-ts-config");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
extends: ["airbnb", "airbnb/hooks"],
|
|
5
|
+
rules: {
|
|
6
|
+
"react/function-component-definition": [
|
|
7
|
+
"error",
|
|
8
|
+
{
|
|
9
|
+
namedComponents: ["arrow-function"],
|
|
10
|
+
unnamedComponents: ["arrow-function"],
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
overrides: [
|
|
15
|
+
{
|
|
16
|
+
files: ["**/*.ts?(x)"],
|
|
17
|
+
extends: [
|
|
18
|
+
"airbnb-typescript",
|
|
19
|
+
"plugin:@typescript-eslint/recommended",
|
|
20
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
21
|
+
],
|
|
22
|
+
parserOptions: {
|
|
23
|
+
project: getTsConfig(),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
package/react-jsx.js
ADDED
package/react.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const fs = require("node:fs");
|
|
2
|
+
const path = require("node:path");
|
|
3
|
+
|
|
4
|
+
const geTsConfig = () => {
|
|
5
|
+
if (fs.existsSync("tsconfig.json")) return path.resolve("tsconfig.json");
|
|
6
|
+
return fs.existsSync("../tsconfig.json")
|
|
7
|
+
? path.resolve("../tsconfig.json")
|
|
8
|
+
: undefined;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
module.exports = geTsConfig;
|