@hakula139/eslint-config 0.0.0-stage → 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hakula
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,91 @@
1
- # Temporary Holding Version
1
+ # @hakula139/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
+ [![CI](https://github.com/hakula139/eslint-config/actions/workflows/ci.yml/badge.svg)](https://github.com/hakula139/eslint-config/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+
6
+ Shared ESLint flat configs for Hakula's JavaScript and TypeScript repositories. Each preset is a config array to compose with ESLint's `defineConfig`, and Prettier owns formatting, so no preset sets a formatting rule.
7
+
8
+ ## Presets
9
+
10
+ ### `@hakula139/eslint-config`
11
+
12
+ Lints every file ESLint lints with `@eslint/js` recommended, strict equality, braces on every block, `const`, no `var`, `no-throw-literal`, object shorthand, and sorted, deduplicated imports.
13
+
14
+ ### `@hakula139/eslint-config/typescript`
15
+
16
+ Lints `**/*.{ts,tsx,mts,cts}` with typescript-eslint's `strictTypeChecked` and `stylisticTypeChecked`, PascalCase type names, separate type imports, exhaustive `switch`, and template literals that interpolate only strings and numbers.
17
+
18
+ ### Exceptions
19
+
20
+ Both presets ignore an unused binding whose name starts with `_`, and a property destructured beside a rest element. The TypeScript preset turns off `@typescript-eslint/require-await`, so an `async` function can implement an interface without awaiting.
21
+
22
+ ## Installation
23
+
24
+ Install ESLint 10 and `globals` beside the base preset:
25
+
26
+ ```bash
27
+ pnpm add -D @hakula139/eslint-config eslint globals
28
+ ```
29
+
30
+ The TypeScript preset also needs typescript-eslint 8.56 or later and a TypeScript version that release supports. typescript-eslint does not support TypeScript 7 yet, so the command installs TypeScript 6:
31
+
32
+ ```bash
33
+ pnpm add -D typescript@^6 typescript-eslint
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ List `base`, then `typescript`, then the project's own globals, rules, and ignores in `eslint.config.js`:
39
+
40
+ ```js
41
+ import base from '@hakula139/eslint-config';
42
+ import { defineConfig } from 'eslint/config';
43
+ import globals from 'globals';
44
+
45
+ export default defineConfig([
46
+ base,
47
+ {
48
+ languageOptions: {
49
+ globals: globals.node,
50
+ },
51
+ },
52
+ ]);
53
+ ```
54
+
55
+ The base preset sets no globals, so add the environments the code runs in.
56
+
57
+ ### TypeScript
58
+
59
+ The TypeScript preset lints with type information through typescript-eslint's project service, which finds each file's nearest `tsconfig.json`. Set `tsconfigRootDir` to the config's directory, since typescript-eslint can infer it only when `eslint.config.js` reads its configs directly:
60
+
61
+ ```js
62
+ import base from '@hakula139/eslint-config';
63
+ import typescript from '@hakula139/eslint-config/typescript';
64
+ import { defineConfig } from 'eslint/config';
65
+
66
+ export default defineConfig([
67
+ base,
68
+ typescript,
69
+ {
70
+ languageOptions: {
71
+ parserOptions: {
72
+ tsconfigRootDir: import.meta.dirname,
73
+ },
74
+ },
75
+ },
76
+ ]);
77
+ ```
78
+
79
+ Each linted TypeScript file must belong to its discovered `tsconfig.json`. For files outside that project, the [project-service troubleshooting guide](https://typescript-eslint.io/troubleshooting/typed-linting/#project-service-issues) covers inclusion, ignores, a small default-project set, and disabling type-aware linting.
80
+
81
+ ## Versioning
82
+
83
+ Any release that can make a passing project fail its lint is major, so minor and patch updates can merge without review. [RELEASING.md](RELEASING.md) defines the policy.
84
+
85
+ ## Development
86
+
87
+ [`AGENTS.md`](AGENTS.md) is the contributor entry point for people and coding agents alike.
88
+
89
+ ## License
90
+
91
+ Copyright (c) 2026 [Hakula](https://hakula.xyz). Licensed under the [MIT License](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@hakula139/eslint-config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "Shared ESLint flat configs for JavaScript and TypeScript",
5
+ "keywords": [
6
+ "eslint",
7
+ "eslintconfig",
8
+ "eslint-config"
9
+ ],
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/hakula139/eslint-config.git"
14
+ },
15
+ "homepage": "https://github.com/hakula139/eslint-config",
16
+ "bugs": {
17
+ "url": "https://github.com/hakula139/eslint-config/issues"
18
+ },
19
+ "type": "module",
20
+ "exports": {
21
+ ".": "./src/index.js",
22
+ "./typescript": "./src/typescript.js"
23
+ },
24
+ "files": [
25
+ "src"
26
+ ],
27
+ "dependencies": {
28
+ "@eslint/js": "^10.0.1",
29
+ "eslint-plugin-perfectionist": "^5.13.0"
30
+ },
31
+ "peerDependencies": {
32
+ "eslint": "^10.0.0",
33
+ "typescript-eslint": "^8.56.0"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "typescript-eslint": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "devEngines": {
41
+ "packageManager": {
42
+ "name": "pnpm",
43
+ "version": "^12.0.0",
44
+ "onFail": "error"
45
+ }
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "devDependencies": {
51
+ "eslint": "^10.14.0",
52
+ "typescript": "^6.0.3",
53
+ "typescript-eslint": "^8.72.1"
54
+ },
55
+ "scripts": {
56
+ "test": "node --test 'test/*.test.js'"
57
+ }
6
58
  }
package/src/index.js ADDED
@@ -0,0 +1,37 @@
1
+ import js from '@eslint/js';
2
+ import perfectionist from 'eslint-plugin-perfectionist';
3
+ import { defineConfig } from 'eslint/config';
4
+
5
+ import { unusedVarsOptions } from './unused-vars.js';
6
+
7
+ export default defineConfig([
8
+ js.configs.recommended,
9
+ {
10
+ name: 'hakula139/base',
11
+ plugins: {
12
+ perfectionist,
13
+ },
14
+ rules: {
15
+ 'curly': 'error',
16
+ 'eqeqeq': 'error',
17
+ 'no-duplicate-imports': ['error', { allowSeparateTypeImports: true }],
18
+ 'no-throw-literal': 'error',
19
+ 'no-unused-vars': ['error', unusedVarsOptions],
20
+ 'no-var': 'error',
21
+ 'object-shorthand': 'error',
22
+ 'prefer-const': 'error',
23
+ 'perfectionist/sort-imports': [
24
+ 'error',
25
+ {
26
+ groups: [
27
+ ['type-builtin', 'value-builtin'],
28
+ ['type-external', 'value-external'],
29
+ ['type-internal', 'value-internal'],
30
+ 'unknown',
31
+ ],
32
+ },
33
+ ],
34
+ 'perfectionist/sort-named-imports': ['error', { groups: ['value-import', 'type-import'] }],
35
+ },
36
+ },
37
+ ]);
@@ -0,0 +1,36 @@
1
+ import { defineConfig } from 'eslint/config';
2
+ import tseslint from 'typescript-eslint';
3
+
4
+ import { unusedVarsOptions } from './unused-vars.js';
5
+
6
+ export default defineConfig({
7
+ name: 'hakula139/typescript',
8
+ files: ['**/*.{ts,tsx,mts,cts}'],
9
+ extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked],
10
+ languageOptions: {
11
+ parserOptions: {
12
+ projectService: true,
13
+ },
14
+ },
15
+ rules: {
16
+ '@typescript-eslint/consistent-type-imports': 'error',
17
+ '@typescript-eslint/naming-convention': [
18
+ 'error',
19
+ { selector: 'typeLike', format: ['PascalCase'], leadingUnderscore: 'allow' },
20
+ ],
21
+ '@typescript-eslint/no-unused-vars': ['error', unusedVarsOptions],
22
+ '@typescript-eslint/require-await': 'off',
23
+ '@typescript-eslint/restrict-template-expressions': [
24
+ 'error',
25
+ {
26
+ allow: [],
27
+ allowAny: false,
28
+ allowBoolean: false,
29
+ allowNullish: false,
30
+ allowNumber: true,
31
+ allowRegExp: false,
32
+ },
33
+ ],
34
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
35
+ },
36
+ });
@@ -0,0 +1,7 @@
1
+ export const unusedVarsOptions = {
2
+ argsIgnorePattern: '^_',
3
+ caughtErrorsIgnorePattern: '^_',
4
+ destructuredArrayIgnorePattern: '^_',
5
+ ignoreRestSiblings: true,
6
+ varsIgnorePattern: '^_',
7
+ };