@sonsu-lee/eslint-config 0.0.0-stage → 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sonsu Lee
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 CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
1
+ # @sonsu-lee/eslint-config
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Run the `sonsu-lee-eslint` rules that need TypeScript types and cannot run in Oxlint. Keep `@sonsu-lee/oxlint-config` for the rest of your lint rules.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ pnpm add -D eslint typescript@6 @sonsu-lee/eslint-config
9
+ ```
10
+
11
+ Install TypeScript 6 rather than 7: the typescript-eslint parser does not support TypeScript 7. The preset uses the parser's project service to read types from the `tsconfig.json` that includes each linted file.
12
+
13
+ ## Use
14
+
15
+ Create `eslint.config.mjs`:
16
+
17
+ ```js
18
+ import { preset } from '@sonsu-lee/eslint-config';
19
+
20
+ export default preset();
21
+ ```
22
+
23
+ From the directory containing `tsconfig.json`, run `oxlint && eslint src`. Replace `src` with the source paths included in your TypeScript project. Running `eslint` without a path also picks up files like `oxlint.config.ts`, which the project service cannot lint unless a `tsconfig.json` includes them.
24
+
25
+ The preset enables the typed ESLint rule only for `.ts`, `.tsx`, `.mts`, and `.cts` files. It also parses JSX in JavaScript files and ignores `dist` and `coverage` directories.
26
+
27
+ Pass project-specific ESLint config objects to `preset()` to apply them last. A severity override for `sonsu-lee-eslint/no-ignored-rejection` without `files` keeps the rule scoped to TypeScript files.
28
+
29
+ Use `// oxlint-disable-next-line <rule> -- <reason>` for rules that run only in Oxlint. ESLint reports an unknown rule ID if you name an Oxlint-only rule in an `eslint-disable` comment, even though the preset turns off unused-disable reporting.
30
+
31
+ ## Run ESLint from a subdirectory
32
+
33
+ If you run ESLint from a subdirectory, set `languageOptions.parserOptions.tsconfigRootDir` to the project's absolute path. When `eslint.config.mjs` sits next to `tsconfig.json`, use `import.meta.dirname`:
34
+
35
+ ```js
36
+ import { preset } from '@sonsu-lee/eslint-config';
37
+
38
+ export default preset({
39
+ languageOptions: { parserOptions: { tsconfigRootDir: import.meta.dirname } },
40
+ });
41
+ ```
42
+
43
+ For example, from `src`, run `eslint .`.
@@ -0,0 +1,2 @@
1
+ import { Linter } from "eslint";
2
+ export declare function preset(...userConfigs: Linter.Config[]): Linter.Config[];
package/dist/index.mjs ADDED
@@ -0,0 +1,45 @@
1
+ import plugin from "@sonsu-lee/eslint-plugin";
2
+ import * as parser from "@typescript-eslint/parser";
3
+ // src/preset.ts
4
+ const typedFiles = ["**/*.{ts,tsx,mts,cts}"];
5
+ const noIgnoredRejection = "sonsu-lee-eslint/no-ignored-rejection";
6
+ function preset(...userConfigs) {
7
+ return [
8
+ {
9
+ name: "sonsu-lee/ignores",
10
+ ignores: ["**/dist/**", "**/coverage/**"]
11
+ },
12
+ {
13
+ name: "sonsu-lee/base",
14
+ linterOptions: { reportUnusedDisableDirectives: "off" },
15
+ plugins: { "sonsu-lee-eslint": plugin }
16
+ },
17
+ {
18
+ name: "sonsu-lee/javascript",
19
+ files: ["**/*.{js,mjs,cjs}"],
20
+ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } }
21
+ },
22
+ {
23
+ name: "sonsu-lee/typed",
24
+ files: typedFiles,
25
+ languageOptions: {
26
+ parser,
27
+ parserOptions: { projectService: true }
28
+ },
29
+ rules: { [noIgnoredRejection]: "error" }
30
+ },
31
+ ...userConfigs.flatMap((config) => {
32
+ if (config.files || !config.rules || !(noIgnoredRejection in config.rules)) return [config];
33
+ const { [noIgnoredRejection]: severity, ...rules } = config.rules;
34
+ return [{
35
+ ...config,
36
+ rules
37
+ }, {
38
+ ...config,
39
+ files: typedFiles,
40
+ rules: { [noIgnoredRejection]: severity }
41
+ }];
42
+ })
43
+ ];
44
+ }
45
+ export { preset };
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@sonsu-lee/eslint-config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "ESLint preset for type-aware rules that cannot run in Oxlint",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/sonsu-lee/style-guide.git",
9
+ "directory": "packages/eslint-config"
10
+ },
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "type": "module",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.mts",
18
+ "default": "./dist/index.mjs"
19
+ }
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "dependencies": {
25
+ "@sonsu-lee/eslint-plugin": "^0.1.0",
26
+ "@types/eslint": "9.6.1",
27
+ "@typescript-eslint/parser": "8.74.0"
28
+ },
29
+ "devDependencies": {
30
+ "@sonsu-lee/oxlint-config": "^0.1.0",
31
+ "@typescript-eslint/rule-tester": "8.74.0",
32
+ "eslint": "10.15.0",
33
+ "oxlint": "1.90.0",
34
+ "oxlint-tsgolint": "7.0.2005",
35
+ "tsdown": "0.23.4",
36
+ "typescript": "6.0.3",
37
+ "vitest": "5.0.5"
38
+ },
39
+ "peerDependencies": {
40
+ "eslint": "^9.0.0 || ^10.0.0",
41
+ "typescript": ">=4.8.4 <6.1.0"
42
+ },
43
+ "scripts": {
44
+ "build": "tsdown",
45
+ "test": "vitest run",
46
+ "typecheck": "tsc",
47
+ "lint": "oxlint"
48
+ }
6
49
  }