@ololoepepe/eslint-config-typescript 0.0.11 → 0.1.1
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/CHANGELOG.md +76 -0
- package/README.md +158 -1
- package/package.json +33 -13
- package/src/index.js +80 -308
- package/src/node.js +27 -0
- package/src/plugins/eslint-comments.js +16 -0
- package/src/plugins/import-x.js +107 -0
- package/src/plugins/n.js +48 -0
- package/src/plugins/perfectionist.js +8 -2
- package/src/plugins/promise.js +25 -0
- package/src/plugins/react-hooks.js +32 -0
- package/src/plugins/react.js +91 -0
- package/src/plugins/regexp.js +86 -0
- package/src/plugins/stylistic.js +177 -0
- package/src/plugins/typescript/index.js +1 -1
- package/src/plugins/unicorn.js +329 -0
- package/src/react.js +48 -0
- package/src/rules/core.js +126 -0
- package/src/rules/jsx-stylistic.js +62 -0
- package/src/rules/no.js +3 -35
- package/src/plugins/import.js +0 -108
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file. The format is
|
|
4
|
+
based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this
|
|
5
|
+
project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [0.1.1] - 2026-07-01
|
|
8
|
+
|
|
9
|
+
### Documentation
|
|
10
|
+
|
|
11
|
+
- Expanded the README into full package documentation: highlights, config entry
|
|
12
|
+
points (`base` / `/node` / `/react`), installation, usage examples, a
|
|
13
|
+
type-aware linting section (project service / `tsconfig.json` requirement), and
|
|
14
|
+
the enforced conventions.
|
|
15
|
+
|
|
16
|
+
## [0.1.0] - 2026-07-01
|
|
17
|
+
|
|
18
|
+
A major modernization of the config, brought to parity with the sibling
|
|
19
|
+
`@ololoepepe/eslint-config` while staying standalone and TypeScript-specific.
|
|
20
|
+
**This release contains breaking changes.**
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **BREAKING:** Upgraded to **ESLint 10** (`>= 10.4`) and migrated to the **flat
|
|
25
|
+
config** format. The legacy `.eslintrc` format is no longer supported.
|
|
26
|
+
- **BREAKING:** Each entry point now exports a **flat-config array** to be spread
|
|
27
|
+
into a consumer's `eslint.config.js`, instead of a legacy config object
|
|
28
|
+
(`env` / `parser` / `parserOptions` / `plugins: []` / `rules: {}`).
|
|
29
|
+
- **BREAKING:** Replaced `eslint-plugin-import` with **`eslint-plugin-import-x`**
|
|
30
|
+
(all `import/*` rules are now `import-x/*`).
|
|
31
|
+
- **BREAKING:** Core formatting rules were moved to **`@stylistic/eslint-plugin`**
|
|
32
|
+
(`@stylistic/*`), mirroring their removal from ESLint core in v10. Options are
|
|
33
|
+
preserved 1:1.
|
|
34
|
+
- Adopted the **`typescript-eslint@8`** meta-package; typed linting is enabled via
|
|
35
|
+
`parserOptions.projectService`. The `@typescript-eslint/*` rule prefixes are
|
|
36
|
+
unchanged.
|
|
37
|
+
- Bumped **`eslint-plugin-perfectionist`** to `^5.9` — retained as this package's
|
|
38
|
+
distinctive type/interface/enum-sorting feature.
|
|
39
|
+
- Bumped `eslint-plugin-sort-keys-shorthand` to `^5`; it is now the **sole owner**
|
|
40
|
+
of object-literal key ordering (shorthand-first).
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- **Layered entry points:**
|
|
45
|
+
- `@ololoepepe/eslint-config-typescript` — env-neutral TypeScript base.
|
|
46
|
+
- `@ololoepepe/eslint-config-typescript/node` — base + Node globals +
|
|
47
|
+
`eslint-plugin-n`.
|
|
48
|
+
- `@ololoepepe/eslint-config-typescript/react` — base + browser globals +
|
|
49
|
+
`@eslint-react`, `eslint-plugin-react-hooks`, and JSX `@stylistic`, scoped to
|
|
50
|
+
`.tsx` / `.jsx`.
|
|
51
|
+
- Correctness plugins on the base: **`unicorn`**, **`regexp`**, **`promise`**, and
|
|
52
|
+
**`@eslint-community/eslint-comments`**, each with an explicitly configured rule
|
|
53
|
+
map.
|
|
54
|
+
- **`typescript`** as a peer dependency (`>=5 <6.1`) and dev dependency.
|
|
55
|
+
- A **fixture-driven test suite** (positive + negative fixtures across the base,
|
|
56
|
+
`/node`, and `/react` layers), alongside the retained self-lint test.
|
|
57
|
+
- The base config now registers TypeScript file extensions (`.ts` / `.cts` /
|
|
58
|
+
`.mts`), so `eslint .` lints TypeScript out of the box.
|
|
59
|
+
|
|
60
|
+
### Removed
|
|
61
|
+
|
|
62
|
+
- **BREAKING:** Removed `eslint-plugin-import`, `eslint-find-rules`, and the
|
|
63
|
+
`find-rules` script.
|
|
64
|
+
- Removed core rules that no longer exist in ESLint 10, replacing them with their
|
|
65
|
+
modern equivalents or `@typescript-eslint/*` typed analogs (single owner per
|
|
66
|
+
concern, no double-reporting).
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
- Resolved rule conflicts between overlapping plugins:
|
|
71
|
+
- Object-literal key ordering: `perfectionist/sort-objects` disabled in favor of
|
|
72
|
+
`sort-keys-shorthand` (shorthand-first).
|
|
73
|
+
- Import-statement ordering: `perfectionist/sort-imports` disabled in favor of
|
|
74
|
+
`import-x/order` (which carries the project path groups).
|
|
75
|
+
- Disabled `n/no-unsupported-features/es-syntax`, since downlevel syntax for
|
|
76
|
+
TypeScript is owned by the compiler (`tsconfig` `target`).
|
package/README.md
CHANGED
|
@@ -1 +1,158 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ololoepepe/eslint-config-typescript
|
|
2
|
+
|
|
3
|
+
A shareable [ESLint](https://eslint.org/) configuration for **TypeScript**
|
|
4
|
+
projects.
|
|
5
|
+
|
|
6
|
+
It aims to **cover as many cases as possible** and to enforce a **single,
|
|
7
|
+
unambiguous code style** wherever a clear "right answer" exists — leaving a rule
|
|
8
|
+
off only when the preferred style genuinely depends on context, or when a
|
|
9
|
+
compromise is worth it for ergonomics. Every available rule is configured
|
|
10
|
+
explicitly, including the ones turned off.
|
|
11
|
+
|
|
12
|
+
It is the TypeScript-oriented sibling of
|
|
13
|
+
[`@ololoepepe/eslint-config`](https://gitea.void-walkers.com/libs/eslint-config):
|
|
14
|
+
a **standalone** config (it keeps its own copy of the core/formatting rules
|
|
15
|
+
rather than depending on the base package) that adds full **type-aware**
|
|
16
|
+
linting and TypeScript-specific rules on top.
|
|
17
|
+
|
|
18
|
+
## Highlights
|
|
19
|
+
|
|
20
|
+
- **Flat config** (ESLint's modern format) — each entry point is exported as a
|
|
21
|
+
config array.
|
|
22
|
+
- **ESLint 10** with all formatting rules provided by
|
|
23
|
+
[`@stylistic/eslint-plugin`](https://eslint.style/).
|
|
24
|
+
- **Type-aware linting** via
|
|
25
|
+
[`typescript-eslint`](https://typescript-eslint.io/) — the `@typescript-eslint`
|
|
26
|
+
rules run with full type information (`parserOptions.projectService`), and core
|
|
27
|
+
rules are replaced by their typed analogs wherever one exists.
|
|
28
|
+
- **Type / interface / enum sorting** via
|
|
29
|
+
[`eslint-plugin-perfectionist`](https://perfectionist.dev/) — the distinctive
|
|
30
|
+
feature of this package.
|
|
31
|
+
- **Import hygiene** via
|
|
32
|
+
[`eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x)
|
|
33
|
+
with the TypeScript resolver.
|
|
34
|
+
- **Promise / async correctness** via
|
|
35
|
+
[`eslint-plugin-promise`](https://github.com/eslint-community/eslint-plugin-promise).
|
|
36
|
+
- **Regex correctness & style** via
|
|
37
|
+
[`eslint-plugin-regexp`](https://github.com/ota-meshi/eslint-plugin-regexp).
|
|
38
|
+
- **Modern idioms & a large catch-all of correctness rules** via
|
|
39
|
+
[`eslint-plugin-unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn).
|
|
40
|
+
- **React** (opt-in `/react` layer) via
|
|
41
|
+
[`@eslint-react`](https://eslint-react.xyz/) and the official
|
|
42
|
+
[`eslint-plugin-react-hooks`](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks),
|
|
43
|
+
with type-aware React rules on `.tsx`.
|
|
44
|
+
- **Sorted object keys** via
|
|
45
|
+
[`eslint-plugin-sort-keys-shorthand`](https://github.com/leonardovillela/eslint-plugin-sort-keys-shorthand).
|
|
46
|
+
- **Disciplined `eslint-disable` comments** via
|
|
47
|
+
[`@eslint-community/eslint-plugin-eslint-comments`](https://github.com/eslint-community/eslint-plugin-eslint-comments).
|
|
48
|
+
|
|
49
|
+
## Config entry points
|
|
50
|
+
|
|
51
|
+
The package is **environment-neutral by default** and ships environment layers
|
|
52
|
+
on top of it:
|
|
53
|
+
|
|
54
|
+
- **`@ololoepepe/eslint-config-typescript`** — the base config. Language + style
|
|
55
|
+
+ import + promise + correctness + type-aware `@typescript-eslint` rules. No
|
|
56
|
+
environment globals beyond standard ES, no Node- or browser-specific rules.
|
|
57
|
+
Use this directly for environment-agnostic code, or as the base for an
|
|
58
|
+
environment-specific config.
|
|
59
|
+
- **`@ololoepepe/eslint-config-typescript/node`** — the base **plus** a Node
|
|
60
|
+
layer: Node globals and
|
|
61
|
+
[`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n). Use
|
|
62
|
+
this for Node.js libraries and applications.
|
|
63
|
+
- **`@ololoepepe/eslint-config-typescript/react`** — the base **plus** a React
|
|
64
|
+
layer: browser globals, [`@eslint-react`](https://eslint-react.xyz/),
|
|
65
|
+
`eslint-plugin-react-hooks`, and JSX formatting via `@stylistic`. Targets
|
|
66
|
+
modern function components and lints `.tsx` / `.jsx` files, with type-aware
|
|
67
|
+
React rules.
|
|
68
|
+
|
|
69
|
+
## Requirements
|
|
70
|
+
|
|
71
|
+
- ESLint `>= 10.4`
|
|
72
|
+
- TypeScript `>= 5 < 6.1` (peer dependency — you provide it)
|
|
73
|
+
- Node.js `>= 24`
|
|
74
|
+
- A `tsconfig.json` for your project (required for type-aware linting — see
|
|
75
|
+
[Type-aware linting](#type-aware-linting)).
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
npm install --save-dev @ololoepepe/eslint-config-typescript typescript
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
This package is **ESM**. Each entry point exports a flat-config array — spread it
|
|
86
|
+
into your own `eslint.config.js` and add any project-specific overrides
|
|
87
|
+
afterwards.
|
|
88
|
+
|
|
89
|
+
For a **Node.js** project:
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
// eslint.config.js
|
|
93
|
+
import ololoepepe from '@ololoepepe/eslint-config-typescript/node';
|
|
94
|
+
|
|
95
|
+
export default [
|
|
96
|
+
...ololoepepe,
|
|
97
|
+
{
|
|
98
|
+
// Your project-specific overrides.
|
|
99
|
+
rules: {}
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
For a **React** project:
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
// eslint.config.js
|
|
108
|
+
import ololoepepe from '@ololoepepe/eslint-config-typescript/react';
|
|
109
|
+
|
|
110
|
+
export default [
|
|
111
|
+
...ololoepepe,
|
|
112
|
+
{
|
|
113
|
+
// Your project-specific overrides.
|
|
114
|
+
rules: {}
|
|
115
|
+
}
|
|
116
|
+
];
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For an **environment-agnostic** project, or as the base for another config,
|
|
120
|
+
import `@ololoepepe/eslint-config-typescript` instead and add the environment
|
|
121
|
+
globals and rules your project needs.
|
|
122
|
+
|
|
123
|
+
> CommonJS consumers on Node.js ≥ 22 can still load it via `require()`
|
|
124
|
+
> (`require(ESM)` is supported), but an ESM `eslint.config.js` is recommended.
|
|
125
|
+
|
|
126
|
+
## Type-aware linting
|
|
127
|
+
|
|
128
|
+
The `@typescript-eslint` rules in this config need **type information**. The base
|
|
129
|
+
config enables the TypeScript project service
|
|
130
|
+
(`parserOptions.projectService: true`), which discovers the nearest
|
|
131
|
+
`tsconfig.json` for each linted file automatically. In practice this means:
|
|
132
|
+
|
|
133
|
+
- Your project must have a `tsconfig.json`, and the files you lint must be
|
|
134
|
+
covered by it (via `include` / `files`).
|
|
135
|
+
- `typescript` must be installed (it is a peer dependency).
|
|
136
|
+
|
|
137
|
+
The base registers the TypeScript extensions (`.ts`, `.cts`, `.mts` — plus the
|
|
138
|
+
JavaScript ones), so `eslint .` lints your TypeScript sources out of the box. The
|
|
139
|
+
`/react` layer additionally targets `.tsx` / `.jsx`.
|
|
140
|
+
|
|
141
|
+
## Conventions
|
|
142
|
+
|
|
143
|
+
A few of the style choices the config enforces:
|
|
144
|
+
|
|
145
|
+
- 2-space indentation, Unix line endings, semicolons always, single quotes.
|
|
146
|
+
- Max line length of 120.
|
|
147
|
+
- No trailing commas, no spaces inside braces.
|
|
148
|
+
- Object keys sorted (natural, case-insensitive, shorthand first); types,
|
|
149
|
+
interfaces, enums, and union/intersection members sorted via `perfectionist`.
|
|
150
|
+
- Imports ordered and grouped, no duplicates, no unresolved (via `import-x`).
|
|
151
|
+
- Typed `@typescript-eslint` rules preferred over their core equivalents; explicit
|
|
152
|
+
function/module boundary types where they add clarity.
|
|
153
|
+
- `const` over `let`, never `var`; arrow callbacks; template strings over
|
|
154
|
+
concatenation.
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
UNLICENSED — private package.
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ololoepepe/eslint-config-typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "ESLint config for TypeScript",
|
|
5
5
|
"main": "src/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.js",
|
|
8
|
+
"./node": "./src/node.js",
|
|
9
|
+
"./react": "./src/react.js"
|
|
10
|
+
},
|
|
6
11
|
"imports": {
|
|
7
12
|
"#src/*.js": "./src/*.js"
|
|
8
13
|
},
|
|
9
14
|
"type": "module",
|
|
10
15
|
"scripts": {
|
|
11
|
-
"find-rules": "eslint-find-rules --unused ./src/index.js",
|
|
12
16
|
"lint": "eslint ./src",
|
|
13
|
-
"test": "mocha ./test
|
|
17
|
+
"test": "mocha './test/**/*.test.js'"
|
|
14
18
|
},
|
|
15
19
|
"publishConfig": {
|
|
16
20
|
"registry": "https://registry.npmjs.com"
|
|
@@ -18,7 +22,8 @@
|
|
|
18
22
|
"files": [
|
|
19
23
|
"src",
|
|
20
24
|
"package.json",
|
|
21
|
-
"README.md"
|
|
25
|
+
"README.md",
|
|
26
|
+
"CHANGELOG.md"
|
|
22
27
|
],
|
|
23
28
|
"repository": {
|
|
24
29
|
"type": "git",
|
|
@@ -31,16 +36,31 @@
|
|
|
31
36
|
},
|
|
32
37
|
"homepage": "https://gitea.void-walkers.com/libs/eslint-config-typescript#README",
|
|
33
38
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
36
|
-
"eslint": "^
|
|
37
|
-
"eslint
|
|
38
|
-
"eslint-
|
|
39
|
-
"eslint-plugin-
|
|
40
|
-
"eslint-plugin-
|
|
39
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
|
|
40
|
+
"@eslint-react/eslint-plugin": "^5.10.0",
|
|
41
|
+
"@stylistic/eslint-plugin": "^5.0.0",
|
|
42
|
+
"eslint": "^10.6.0",
|
|
43
|
+
"eslint-import-resolver-typescript": "^4.4.0",
|
|
44
|
+
"eslint-plugin-import-x": "^4.17.0",
|
|
45
|
+
"eslint-plugin-n": "^18.2.1",
|
|
46
|
+
"eslint-plugin-perfectionist": "^5.9.0",
|
|
47
|
+
"eslint-plugin-promise": "^7.3.0",
|
|
48
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
49
|
+
"eslint-plugin-regexp": "^3.1.1",
|
|
50
|
+
"eslint-plugin-sort-keys-shorthand": "^5.0.0",
|
|
51
|
+
"eslint-plugin-unicorn": "^69.0.0",
|
|
52
|
+
"globals": "^17.0.0",
|
|
53
|
+
"ts-declaration-location": "^1.0.7",
|
|
54
|
+
"typescript-eslint": "^8.62.0"
|
|
41
55
|
},
|
|
42
56
|
"devDependencies": {
|
|
43
|
-
"
|
|
44
|
-
"
|
|
57
|
+
"@types/node": "^22.20.0",
|
|
58
|
+
"@types/react": "^19.2.0",
|
|
59
|
+
"mocha": "^11.7.5",
|
|
60
|
+
"react": "^19.2.0",
|
|
61
|
+
"typescript": "^5.9.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"typescript": ">=5 <6.1"
|
|
45
65
|
}
|
|
46
66
|
}
|