@antipain/eslint-config 0.0.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/LICENSE +21 -0
- package/README.md +102 -0
- package/package.json +56 -0
- package/src/configs/css.js +19 -0
- package/src/configs/json.js +23 -0
- package/src/configs/stylistic.js +40 -0
- package/src/configs/typescript.js +42 -0
- package/src/index.js +13 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Wojciech Kosztyła
|
|
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,102 @@
|
|
|
1
|
+
# @antipain/eslint-config
|
|
2
|
+
|
|
3
|
+
An opinionated, batteries-included ESLint Flat Config (ESLint v9+) for modern **TypeScript**, **JavaScript**, **Stylistic Formatting**, **JSON**, and **CSS**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **⚡ ESLint v9 Flat Config:** Native support for the modern `eslint.config.js` format.
|
|
10
|
+
- **🔷 TypeScript & JS:** Modern best practices powered by `typescript-eslint` and `@eslint/js`.
|
|
11
|
+
- **🎨 Code Style & Formatting:** Zero-Prettier setup using `@stylistic/eslint-plugin` (2 spaces, single quotes, 140 line length limit).
|
|
12
|
+
- **📄 Multi-Format Linting:** Built-in linting for `.json` and `.css` files via `@eslint/json` and `@eslint/css`.
|
|
13
|
+
- **⚛️ React Ready:** Ships pre-configured with React Hooks, React Refresh, and JSX Accessibility plugins.
|
|
14
|
+
- **🧩 Modular:** Use the complete bundle or pick only the specific configurations you need.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Install the package alongside `eslint` as dev dependencies:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add -D @antipain/eslint-config eslint
|
|
24
|
+
# or
|
|
25
|
+
npm install -D @antipain/eslint-config eslint
|
|
26
|
+
# or
|
|
27
|
+
yarn add -D @antipain/eslint-config eslint
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
Create an `eslint.config.js` file in the root of your project:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
// eslint.config.js
|
|
36
|
+
import antipainConfig from '@antipain/eslint-config';
|
|
37
|
+
|
|
38
|
+
export default [
|
|
39
|
+
...antipainConfig,
|
|
40
|
+
|
|
41
|
+
// Add project-specific ignores or overrides below
|
|
42
|
+
{
|
|
43
|
+
ignores: ['dist/**', 'build/**', 'coverage/**'],
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Modular Usage
|
|
49
|
+
|
|
50
|
+
If you don't need the entire suite (for example,
|
|
51
|
+
if you don't want CSS or JSON linting), you can import individual configurations:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
// eslint.config.js
|
|
55
|
+
import { typescript, stylistic } from '@antipain/eslint-config';
|
|
56
|
+
|
|
57
|
+
export default [
|
|
58
|
+
...typescript,
|
|
59
|
+
...stylistic,
|
|
60
|
+
|
|
61
|
+
// Custom project rule overrides
|
|
62
|
+
{
|
|
63
|
+
rules: {
|
|
64
|
+
'no-console': 'off',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Available Named Exports
|
|
71
|
+
|
|
72
|
+
| Export | Files Targeted | Key Tools / Plugins |
|
|
73
|
+
| ------------- | ------------------------------ | ---------------------------------- |
|
|
74
|
+
| `typescript` | `**/*.{ts,tsx,js,jsx,mjs,cjs}` | `@typescript-eslint`, `@eslint/js` |
|
|
75
|
+
| `stylistic` | `**/*.{ts,tsx,js,jsx,mjs,cjs}` | `@stylistic/eslint-plugin` |
|
|
76
|
+
| `json` | `**/*.json` | `@eslint/json` |
|
|
77
|
+
| `css` | `**/*.css` | `@eslint/css` |
|
|
78
|
+
|
|
79
|
+
## Recommended `package.json` Scripts
|
|
80
|
+
|
|
81
|
+
Add these scripts to your `package.json` to run and automatically fix lint issues across your project:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"scripts": {
|
|
86
|
+
"lint": "eslint .",
|
|
87
|
+
"lint:fix": "eslint . --fix"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Key Style Defaults
|
|
93
|
+
|
|
94
|
+
- **Indentation:** 2 spaces
|
|
95
|
+
- **Quotes:** Single (`'`), avoiding escapes
|
|
96
|
+
- **Semicolons:** Always required
|
|
97
|
+
- **Line Length:** 140 characters
|
|
98
|
+
- **Unused Variables:** Ignore variables prefixed with `_` (e.g. `_req`)
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
[MIT](LICENSE) © [Antipain](https://github.com/antipainK)
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@antipain/eslint-config",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Antipain's shared ESLint configuration for modern TypeScript & JavaScript projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/antipainK/lint-configs.git",
|
|
18
|
+
"directory": "typescript"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"eslint",
|
|
22
|
+
"eslintconfig",
|
|
23
|
+
"config",
|
|
24
|
+
"lint",
|
|
25
|
+
"typescript",
|
|
26
|
+
"javascript",
|
|
27
|
+
"flat-config"
|
|
28
|
+
],
|
|
29
|
+
"author": "Antipain",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"eslint": ">=8.57.0"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@eslint/css": "^2.0.0",
|
|
39
|
+
"@eslint/js": "^10.0.1",
|
|
40
|
+
"@eslint/json": "^2.1.0",
|
|
41
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
42
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
43
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
44
|
+
"eslint-plugin-react-refresh": "^0.5.7",
|
|
45
|
+
"globals": "^17.12.0",
|
|
46
|
+
"typescript-eslint": "^8.71.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"eslint": "^10.11.0"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"lint:fix": "eslint . --fix",
|
|
54
|
+
"test": "node --test test/config.test.mjs"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import cssPlugin from '@eslint/css';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
...cssPlugin.configs.recommended,
|
|
6
|
+
files: [ '**/*.css' ],
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
files: [ '**/*.css' ],
|
|
10
|
+
language: 'css/css',
|
|
11
|
+
plugins: {
|
|
12
|
+
css: cssPlugin,
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
'css/no-duplicate-imports': 'error',
|
|
16
|
+
'css/no-empty-blocks': 'error',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import jsonPlugin from '@eslint/json';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
...jsonPlugin.configs.recommended,
|
|
6
|
+
files: [ '**/*.json' ],
|
|
7
|
+
ignores: [ '**/*lock.json' ],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
files: [ '**/*.json' ],
|
|
11
|
+
ignores: [ '**/coverage/**' ],
|
|
12
|
+
language: 'json/jsonc',
|
|
13
|
+
plugins: {
|
|
14
|
+
json: jsonPlugin,
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
'json/no-empty-keys': 'error',
|
|
18
|
+
'json/no-unnormalized-keys': 'error',
|
|
19
|
+
'json/no-unsafe-values': 'error',
|
|
20
|
+
'json/no-duplicate-keys': 'error',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
...stylisticPlugin.configs.recommended,
|
|
6
|
+
files: [ '**/*.{ts,tsx,js,jsx,mjs,cjs}' ],
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
files: [ '**/*.{ts,tsx,js,jsx,mjs,cjs}' ],
|
|
10
|
+
rules: {
|
|
11
|
+
'@stylistic/array-bracket-spacing': [ 'error', 'always', { arraysInArrays: false } ],
|
|
12
|
+
'@stylistic/arrow-parens': [ 'error', 'always' ],
|
|
13
|
+
'@stylistic/brace-style': [ 'error', '1tbs' ],
|
|
14
|
+
'@stylistic/comma-dangle': [ 'error', 'always-multiline' ],
|
|
15
|
+
'@stylistic/comma-spacing': [ 'error', { before: false, after: true } ],
|
|
16
|
+
'@stylistic/indent': [ 'error', 2 ],
|
|
17
|
+
'@stylistic/jsx-quotes': [ 'error', 'prefer-single' ],
|
|
18
|
+
'@stylistic/max-len': [ 'warn', { code: 140, ignoreUrls: true, ignoreStrings: true } ],
|
|
19
|
+
'@stylistic/no-multiple-empty-lines': [ 'error', { max: 2, maxBOF: 1, maxEOF: 1 } ],
|
|
20
|
+
'@stylistic/no-trailing-spaces': 'error',
|
|
21
|
+
'@stylistic/object-curly-spacing': [ 'error', 'always', { arraysInObjects: false, objectsInObjects: false } ],
|
|
22
|
+
'@stylistic/padding-line-between-statements': [
|
|
23
|
+
'error',
|
|
24
|
+
{
|
|
25
|
+
blankLine: 'always',
|
|
26
|
+
prev: [ 'block', 'block-like', 'multiline-expression', 'class', 'multiline-const', 'const' ],
|
|
27
|
+
next: '*',
|
|
28
|
+
},
|
|
29
|
+
{ blankLine: 'always', prev: '*', next: [ 'multiline-expression', 'if', 'return' ]},
|
|
30
|
+
{ blankLine: 'any', prev: [ 'singleline-const' ], next: [ 'singleline-const' ]} ],
|
|
31
|
+
'@stylistic/quotes': [ 'error', 'single', { avoidEscape: true } ],
|
|
32
|
+
'@stylistic/semi': [ 'error', 'always', { omitLastInOneLineClassBody: true } ],
|
|
33
|
+
'arrow-body-style': [ 'error', 'as-needed', { requireReturnForObjectLiteral: true } ],
|
|
34
|
+
'sort-imports': [ 'error', { ignoreCase: true, ignoreDeclarationSort: true } ],
|
|
35
|
+
'sort-keys': [ 'warn', 'asc', { caseSensitive: false, minKeys: 5 } ],
|
|
36
|
+
'yoda': [ 'warn', 'never', { onlyEquality: true } ],
|
|
37
|
+
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import tseslint from 'typescript-eslint';
|
|
2
|
+
import js from '@eslint/js';
|
|
3
|
+
|
|
4
|
+
export default tseslint.config({
|
|
5
|
+
extends: [
|
|
6
|
+
js.configs.recommended,
|
|
7
|
+
...tseslint.configs.recommended,
|
|
8
|
+
],
|
|
9
|
+
files: [ '**/*.{ts,tsx,js,jsx,mjs,cjs}' ],
|
|
10
|
+
linterOptions: {
|
|
11
|
+
reportUnusedInlineConfigs: 'error',
|
|
12
|
+
reportUnusedDisableDirectives: 'error',
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
'@typescript-eslint/ban-ts-comment': 'error',
|
|
16
|
+
'@typescript-eslint/no-empty-function': 'warn',
|
|
17
|
+
'@typescript-eslint/no-unused-vars': [ 'error', {
|
|
18
|
+
argsIgnorePattern: '^_',
|
|
19
|
+
varsIgnorePattern: '^_',
|
|
20
|
+
ignoreRestSiblings: true,
|
|
21
|
+
} ],
|
|
22
|
+
'class-methods-use-this': [ 'warn', { enforceForClassFields: false, ignoreOverrideMethods: true } ],
|
|
23
|
+
'curly': 'error',
|
|
24
|
+
'default-param-last': 'error',
|
|
25
|
+
'dot-notation': 'error',
|
|
26
|
+
'eqeqeq': [ 'error', 'smart' ],
|
|
27
|
+
'no-await-in-loop': 'warn',
|
|
28
|
+
'no-console': 'warn',
|
|
29
|
+
'no-constructor-return': 'warn',
|
|
30
|
+
'no-duplicate-imports': 'error',
|
|
31
|
+
'no-else-return': 'error',
|
|
32
|
+
'no-implicit-coercion': 'warn',
|
|
33
|
+
'no-param-reassign': [ 'error', { props: false } ],
|
|
34
|
+
'no-promise-executor-return': 'error',
|
|
35
|
+
'no-self-compare': 'warn',
|
|
36
|
+
'no-unneeded-ternary': 'warn',
|
|
37
|
+
'no-useless-return': 'error',
|
|
38
|
+
'no-var': 'error',
|
|
39
|
+
'prefer-const': [ 'error', { destructuring: 'all' } ],
|
|
40
|
+
'prefer-template': 'warn',
|
|
41
|
+
},
|
|
42
|
+
});
|
package/src/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import css from './configs/css.js';
|
|
2
|
+
import json from './configs/json.js';
|
|
3
|
+
import typescript from './configs/typescript.js';
|
|
4
|
+
import stylistic from './configs/stylistic.js';
|
|
5
|
+
|
|
6
|
+
export { css, json, typescript, stylistic };
|
|
7
|
+
|
|
8
|
+
export default [
|
|
9
|
+
...typescript,
|
|
10
|
+
...stylistic,
|
|
11
|
+
...json,
|
|
12
|
+
...css,
|
|
13
|
+
];
|