@kitschpatrol/eslint-config 1.0.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/LICENSE +21 -0
- package/init/.eslintignore +1 -0
- package/init/.eslintrc.cjs +4 -0
- package/init.js +22 -0
- package/main.cjs +76 -0
- package/package.json +46 -0
- package/readme.md +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Eric Mika
|
|
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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# TODO
|
package/init.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import console from 'node:console';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import process from 'node:process';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
const sourceDirectory = path.join(__dirname, 'init');
|
|
10
|
+
const destinationDirectory = process.cwd(); // (project root)
|
|
11
|
+
|
|
12
|
+
for (const file of fs.readdirSync(sourceDirectory)) {
|
|
13
|
+
const sourcePath = path.join(sourceDirectory, file);
|
|
14
|
+
const destinationPath = path.join(destinationDirectory, file);
|
|
15
|
+
|
|
16
|
+
if (fs.existsSync(destinationPath)) {
|
|
17
|
+
console.log(`${file} already exists in project root, skipping.`);
|
|
18
|
+
} else {
|
|
19
|
+
fs.copyFileSync(sourcePath, destinationPath);
|
|
20
|
+
console.log(`Copied ${file} to project root.`);
|
|
21
|
+
}
|
|
22
|
+
}
|
package/main.cjs
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// eslint-disable-next-line no-undef
|
|
2
|
+
module.exports = {
|
|
3
|
+
// env: {
|
|
4
|
+
// browser: true,
|
|
5
|
+
// es2017: true,
|
|
6
|
+
// node: true,
|
|
7
|
+
// },
|
|
8
|
+
extends: [
|
|
9
|
+
'eslint:recommended',
|
|
10
|
+
'plugin:@typescript-eslint/recommended',
|
|
11
|
+
'plugin:@typescript-eslint/recommended',
|
|
12
|
+
'plugin:astro/recommended',
|
|
13
|
+
'plugin:astro/jsx-a11y-recommended',
|
|
14
|
+
'plugin:svelte/recommended',
|
|
15
|
+
'plugin:unicorn/recommended',
|
|
16
|
+
'prettier',
|
|
17
|
+
'plugin:perfectionist/recommended-natural',
|
|
18
|
+
],
|
|
19
|
+
overrides: [
|
|
20
|
+
{
|
|
21
|
+
files: ['*.astro'],
|
|
22
|
+
parser: 'astro-eslint-parser',
|
|
23
|
+
parserOptions: {
|
|
24
|
+
extraFileExtensions: ['.astro'],
|
|
25
|
+
parser: '@typescript-eslint/parser',
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
'no-unused-vars': [
|
|
29
|
+
'error',
|
|
30
|
+
{
|
|
31
|
+
argsIgnorePattern: '^_',
|
|
32
|
+
destructuredArrayIgnorePattern: '^_',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
'unicorn/filename-case': 'off',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
files: ['*.svelte'],
|
|
40
|
+
parser: 'svelte-eslint-parser',
|
|
41
|
+
parserOptions: {
|
|
42
|
+
parser: '@typescript-eslint/parser',
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
// https://github.com/nuxt/eslint-config/issues/140
|
|
46
|
+
'@typescript-eslint/ban-types': 'off',
|
|
47
|
+
// https://github.com/typescript-eslint/typescript-eslint/blob/1cf9243/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
|
|
48
|
+
'no-undef': 'off',
|
|
49
|
+
'unicorn/filename-case': 'off',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
rules: {
|
|
54
|
+
// possible perfectionist conflicts
|
|
55
|
+
'@typescript-eslint/adjacent-overload-signatures': 'off',
|
|
56
|
+
'@typescript-eslint/sort-type-constituents': 'off',
|
|
57
|
+
'import/order': 'off',
|
|
58
|
+
'perfectionist/sort-imports': [
|
|
59
|
+
'error',
|
|
60
|
+
{
|
|
61
|
+
'newlines-between': 'never',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
'react/jsx-sort-props': 'off',
|
|
65
|
+
'sort-imports': 'off',
|
|
66
|
+
'unicorn/no-array-reduce': 'off',
|
|
67
|
+
'unicorn/prevent-abbreviations': [
|
|
68
|
+
'error',
|
|
69
|
+
{
|
|
70
|
+
allowList: {
|
|
71
|
+
Props: true,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kitschpatrol/eslint-config",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Eslint config for @kitschpatrol/shared-config",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git@github.com:kitschpatrol/shared-config.git",
|
|
9
|
+
"directory": "packages/eslint-config"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/kitschpatrol/shared-config/issues",
|
|
13
|
+
"email": "eric@ericmika.com"
|
|
14
|
+
},
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Eric Mika",
|
|
17
|
+
"email": "eric@ericmika.com",
|
|
18
|
+
"url": "https://ericmika.com"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18.0.0",
|
|
23
|
+
"pnpm": ">=8.0.0"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"eslint-config-init": "./init.js"
|
|
27
|
+
},
|
|
28
|
+
"main": "main.cjs",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"eslint": ">=8.52.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
|
34
|
+
"@typescript-eslint/parser": "^6.13.2",
|
|
35
|
+
"astro-eslint-parser": "^0.16.0",
|
|
36
|
+
"eslint-config-prettier": "^9.1.0",
|
|
37
|
+
"eslint-plugin-astro": "^0.30.0",
|
|
38
|
+
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
39
|
+
"eslint-plugin-perfectionist": "^2.5.0",
|
|
40
|
+
"eslint-plugin-svelte": "^2.35.1",
|
|
41
|
+
"eslint-plugin-unicorn": "^49.0.0"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @kitschpatrol/eslint-config
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
It's a shared [ESLint](https://eslint.org) config.
|
|
6
|
+
|
|
7
|
+
**See [`@kitschpatrol/shared-config`](https://www.npmjs.com/package/@kitschpatrol/shared-config) for the recommended single-package approach.**
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
To use just this ESLint config in isolation:
|
|
12
|
+
|
|
13
|
+
1. Install the `.npmrc` in your project root. This is required for correct PNPM behavior:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
pnpm dlx @kitschpatrol/npm-config
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. Add the package:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
pnpm add @kitschpatrol/eslint-config
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. Add the starter `.eslintrc.cjs` config and `.eslintignore` files to your project root, and add any overrides you'd like:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pnpm exec eslint-config-init
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
The ESLint binary should be picked up automatically by VSCode plugins.
|
|
34
|
+
|
|
35
|
+
Integrate with your `package.json` scripts as you see fit, for example:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
...
|
|
39
|
+
"scripts": {
|
|
40
|
+
"lint": "eslint ."
|
|
41
|
+
"fix": "eslint --fix ."
|
|
42
|
+
}
|
|
43
|
+
...
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Notes
|
|
47
|
+
|
|
48
|
+
The whole flat file config thing is pending...
|