@unix/eslint 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 @unix
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,53 @@
1
+ # @unix/eslint
2
+
3
+ ESLint flat config for @unix projects.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ pnpm add -D @unix/eslint eslint typescript
9
+ ```
10
+
11
+ If your project only uses JavaScript, `typescript` is not required.
12
+
13
+ ## TypeScript Projects
14
+
15
+ Create `eslint.config.js` in the project root:
16
+
17
+ ```js
18
+ import config from '@unix/eslint'
19
+
20
+ export default config
21
+ ```
22
+
23
+ This entry enables the TypeScript rules by default and uses `parserOptions.projectService` to read the project's `tsconfig.json`.
24
+
25
+ ## JavaScript Projects
26
+
27
+ ```js
28
+ import config from '@unix/eslint/js'
29
+
30
+ export default config
31
+ ```
32
+
33
+ ## Extending The Config
34
+
35
+ Spread the default config and append overrides when you need to adjust rules for specific files:
36
+
37
+ ```js
38
+ import config from '@unix/eslint'
39
+
40
+ export default [
41
+ ...config,
42
+ {
43
+ files: ['**/*.{test,spec}.{ts,tsx,mts,cts}'],
44
+ rules: {
45
+ '@typescript-eslint/no-magic-numbers': 'off',
46
+ },
47
+ },
48
+ ]
49
+ ```
50
+
51
+ ## License
52
+
53
+ MIT
package/configs/js.js ADDED
@@ -0,0 +1,137 @@
1
+ // @ts-check
2
+ import eslint from '@eslint/js'
3
+ import stylistic from '@stylistic/eslint-plugin'
4
+
5
+ const jsFiles = ['**/*.{js,mjs,cjs,jsx}']
6
+
7
+ const ignores = [
8
+ '**/node_modules/**',
9
+ '**/.git/**',
10
+ '**/.hg/**',
11
+ '**/.svn/**',
12
+ '**/dist/**',
13
+ '**/build/**',
14
+ '**/coverage/**',
15
+ '**/.cache/**',
16
+ '**/.eslintcache',
17
+ '**/.next/**',
18
+ '**/.nuxt/**',
19
+ '**/.output/**',
20
+ '**/.svelte-kit/**',
21
+ '**/.turbo/**',
22
+ '**/.vite/**',
23
+ '**/storybook-static/**',
24
+ '**/tmp/**',
25
+ '**/temp/**',
26
+ ]
27
+
28
+ const withJsFiles = config => ({
29
+ ...config,
30
+ files: jsFiles,
31
+ })
32
+
33
+ export default [
34
+ {
35
+ ignores,
36
+ },
37
+ {
38
+ files: jsFiles,
39
+ languageOptions: {
40
+ ecmaVersion: 'latest',
41
+ },
42
+ },
43
+ {
44
+ ...eslint.configs.recommended,
45
+ files: jsFiles,
46
+ },
47
+ withJsFiles(stylistic.configs['disable-legacy']),
48
+ withJsFiles(stylistic.configs.recommended),
49
+ {
50
+ files: jsFiles,
51
+ rules: {
52
+ 'func-style': ['error', 'expression', { allowArrowFunctions: true }],
53
+ 'array-callback-return': 'error',
54
+ 'constructor-super': 'error',
55
+ 'for-direction': 'error',
56
+ 'getter-return': 'error',
57
+ 'no-await-in-loop': 'warn',
58
+ 'no-class-assign': 'error',
59
+ 'no-cond-assign': 'error',
60
+ 'no-const-assign': 'error',
61
+ 'no-constant-condition': 'warn',
62
+ 'no-constructor-return': 'error',
63
+ 'no-control-regex': 'error',
64
+ 'no-debugger': 'error',
65
+ 'no-dupe-args': 'error',
66
+ 'no-dupe-class-members': 'error',
67
+ 'no-dupe-else-if': 'error',
68
+ 'no-dupe-keys': 'error',
69
+ 'no-duplicate-case': 'error',
70
+ 'no-duplicate-imports': 'error',
71
+ 'no-empty-character-class': 'error',
72
+ 'no-empty-pattern': 'error',
73
+ 'no-ex-assign': 'error',
74
+ 'no-fallthrough': 'error',
75
+ 'no-func-assign': 'error',
76
+ 'no-import-assign': 'error',
77
+ 'no-inner-declarations': 'error',
78
+ 'no-invalid-regexp': 'error',
79
+ 'no-irregular-whitespace': 'error',
80
+ 'no-loss-of-precision': 'error',
81
+ 'no-self-assign': 'error',
82
+ 'no-self-compare': 'error',
83
+ 'no-setter-return': 'error',
84
+ 'no-sparse-arrays': 'error',
85
+ 'no-template-curly-in-string': 'error',
86
+ 'no-unassigned-vars': 'warn',
87
+ 'no-undef': 'error',
88
+ 'no-unexpected-multiline': 'error',
89
+ 'no-unmodified-loop-condition': 'error',
90
+ 'no-unreachable': 'warn',
91
+ 'no-unsafe-finally': 'error',
92
+ 'no-unsafe-negation': 'warn',
93
+ 'no-unused-private-class-members': 'warn',
94
+ 'no-unused-vars': 'warn',
95
+ 'no-use-before-define': 'error',
96
+ 'no-useless-assignment': 'warn',
97
+ 'require-atomic-updates': 'error',
98
+ 'use-isnan': 'error',
99
+ 'valid-typeof': 'error',
100
+ 'arrow-body-style': ['error', 'as-needed'],
101
+ 'block-scoped-var': 'error',
102
+ complexity: ['error', 3],
103
+ 'consistent-return': 'off',
104
+ 'default-case': 'error',
105
+ 'default-case-last': 'error',
106
+ 'default-param-last': 'error',
107
+ 'dot-notation': 'off',
108
+ eqeqeq: 'error',
109
+ 'max-classes-per-file': ['error', 3],
110
+ 'max-depth': ['error', 3],
111
+ 'max-nested-callbacks': ['error', 4],
112
+ 'max-params': ['error', 4],
113
+ 'no-alert': 'error',
114
+ 'no-case-declarations': 'off',
115
+ 'no-console': 'off',
116
+ 'no-delete-var': 'error',
117
+ 'no-div-regex': 'error',
118
+ 'no-implied-eval': 'error',
119
+ 'no-redeclare': 'error',
120
+ 'no-regex-spaces': 'error',
121
+ 'no-useless-return': 'off',
122
+ 'no-var': 'error',
123
+ 'prefer-arrow-callback': 'error',
124
+ 'prefer-rest-params': 'error',
125
+ 'no-else-return': ['error', { allowElseIf: false }],
126
+ curly: ['error', 'multi'],
127
+ '@stylistic/array-bracket-newline': ['error', { multiline: true }],
128
+ '@stylistic/array-element-newline': ['error', { multiline: true }],
129
+ '@stylistic/arrow-parens': ['error', 'as-needed'],
130
+ '@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
131
+ '@stylistic/linebreak-style': ['error', 'unix'],
132
+ '@stylistic/multiline-comment-style': ['error', 'bare-block'],
133
+ '@stylistic/no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1 }],
134
+ '@stylistic/nonblock-statement-body-position': ['error', 'beside'],
135
+ },
136
+ },
137
+ ]
package/configs/ts.js ADDED
@@ -0,0 +1,191 @@
1
+ // @ts-check
2
+ import eslint from '@eslint/js'
3
+ import stylistic from '@stylistic/eslint-plugin'
4
+ import tseslint from 'typescript-eslint'
5
+
6
+ import js from './js.js'
7
+
8
+ const tsFiles = ['**/*.{ts,mts,cts,tsx}']
9
+
10
+ const classMemberOrder = [
11
+ [
12
+ 'protected-static-readonly-field',
13
+ 'protected-static-field',
14
+ 'private-static-readonly-field',
15
+ 'private-static-field',
16
+ 'public-static-readonly-field',
17
+ 'public-static-field',
18
+ 'static-readonly-field',
19
+ 'static-field',
20
+ ],
21
+ [
22
+ 'protected-static-method',
23
+ 'private-static-method',
24
+ 'public-static-method',
25
+ 'static-method',
26
+ ],
27
+ ['protected-abstract-method', 'public-abstract-method', 'abstract-method'],
28
+ [
29
+ 'protected-decorated-readonly-field',
30
+ 'protected-instance-readonly-field',
31
+ 'protected-readonly-field',
32
+ 'protected-decorated-field',
33
+ 'protected-instance-field',
34
+ 'protected-field',
35
+ 'constructor',
36
+ 'private-instance-readonly-field',
37
+ 'private-readonly-field',
38
+ 'private-instance-field',
39
+ 'private-field',
40
+ 'public-decorated-readonly-field',
41
+ 'public-instance-readonly-field',
42
+ 'public-readonly-field',
43
+ 'public-decorated-field',
44
+ 'public-instance-field',
45
+ 'public-field',
46
+ 'decorated-readonly-field',
47
+ 'instance-readonly-field',
48
+ 'readonly-field',
49
+ 'decorated-field',
50
+ 'instance-field',
51
+ 'field',
52
+ ],
53
+ [
54
+ 'protected-constructor',
55
+ 'private-constructor',
56
+ 'public-constructor',
57
+ 'constructor',
58
+ ],
59
+ [
60
+ 'protected-decorated-method',
61
+ 'protected-instance-method',
62
+ 'protected-method',
63
+ 'private-instance-method',
64
+ 'private-method',
65
+ 'public-decorated-method',
66
+ 'public-instance-method',
67
+ 'public-method',
68
+ 'decorated-method',
69
+ 'instance-method',
70
+ 'method',
71
+ ],
72
+ ]
73
+
74
+ const recommendedTypeChecked = tseslint.configs.recommendedTypeChecked.map(
75
+ config => ({
76
+ ...config,
77
+ files: config.files ?? tsFiles,
78
+ }),
79
+ )
80
+
81
+ const withTsFiles = config => ({
82
+ ...config,
83
+ files: tsFiles,
84
+ })
85
+
86
+ export default tseslint.config(
87
+ ...js,
88
+ {
89
+ ...eslint.configs.recommended,
90
+ files: tsFiles,
91
+ },
92
+ ...recommendedTypeChecked,
93
+ {
94
+ files: tsFiles,
95
+ languageOptions: {
96
+ ecmaVersion: 'latest',
97
+ parserOptions: {
98
+ projectService: true,
99
+ },
100
+ },
101
+ },
102
+ withTsFiles(stylistic.configs['disable-legacy']),
103
+ withTsFiles(stylistic.configs.recommended),
104
+ {
105
+ files: tsFiles,
106
+ rules: {
107
+ '@typescript-eslint/consistent-type-assertions': [
108
+ 'warn',
109
+ { assertionStyle: 'never' },
110
+ ],
111
+ '@typescript-eslint/member-ordering': [
112
+ 'error',
113
+ {
114
+ classes: {
115
+ memberTypes: classMemberOrder,
116
+ },
117
+ },
118
+ ],
119
+ '@typescript-eslint/no-explicit-any': 'warn',
120
+ '@typescript-eslint/no-floating-promises': 'warn',
121
+ 'func-style': ['error', 'expression', { allowArrowFunctions: true }],
122
+ 'no-else-return': ['error', { allowElseIf: false }],
123
+ '@typescript-eslint/await-thenable': 'error',
124
+ '@typescript-eslint/consistent-generic-constructors': ['error', 'constructor'],
125
+ '@typescript-eslint/consistent-type-exports': 'error',
126
+ '@typescript-eslint/consistent-type-imports': 'error',
127
+ 'default-param-last': 'off',
128
+ '@typescript-eslint/default-param-last': 'error',
129
+ '@typescript-eslint/explicit-function-return-type': 'off',
130
+ '@typescript-eslint/explicit-member-accessibility': [
131
+ 'error',
132
+ {
133
+ accessibility: 'no-public',
134
+ },
135
+ ],
136
+ 'max-params': 'off',
137
+ '@typescript-eslint/max-params': [
138
+ 'error',
139
+ {
140
+ countVoidThis: false,
141
+ max: 4,
142
+ },
143
+ ],
144
+ '@typescript-eslint/no-array-delete': 'error',
145
+ '@typescript-eslint/no-duplicate-enum-values': 'error',
146
+ '@typescript-eslint/no-dynamic-delete': 'error',
147
+ '@typescript-eslint/no-empty-object-type': 'error',
148
+ '@typescript-eslint/no-extra-non-null-assertion': 'error',
149
+ '@typescript-eslint/no-for-in-array': 'error',
150
+ 'no-implied-eval': 'off',
151
+ '@typescript-eslint/no-implied-eval': 'error',
152
+ 'no-magic-numbers': 'off',
153
+ '@typescript-eslint/no-magic-numbers': 'error',
154
+ '@typescript-eslint/no-namespace': 'error',
155
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
156
+ '@typescript-eslint/no-non-null-assertion': 'error',
157
+ 'no-shadow': 'off',
158
+ '@typescript-eslint/no-shadow': 'error',
159
+ '@typescript-eslint/no-this-alias': 'error',
160
+ '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
161
+ '@typescript-eslint/no-unnecessary-condition': 'error',
162
+ '@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
163
+ '@typescript-eslint/no-unnecessary-template-expression': 'error',
164
+ '@typescript-eslint/no-unnecessary-type-constraint': 'error',
165
+ '@typescript-eslint/no-unsafe-argument': 'warn',
166
+ '@typescript-eslint/no-unsafe-assignment': 'warn',
167
+ '@typescript-eslint/no-unsafe-call': 'warn',
168
+ '@typescript-eslint/no-unsafe-member-access': 'warn',
169
+ '@typescript-eslint/no-unsafe-return': 'error',
170
+ 'no-unused-vars': 'off',
171
+ '@typescript-eslint/no-unused-vars': 'warn',
172
+ 'no-use-before-define': 'off',
173
+ '@typescript-eslint/no-use-before-define': 'error',
174
+ '@typescript-eslint/no-useless-empty-export': 'off',
175
+ 'no-throw-literal': 'off',
176
+ '@typescript-eslint/only-throw-error': 'error',
177
+ '@typescript-eslint/prefer-as-const': 'error',
178
+ 'prefer-destructuring': 'off',
179
+ '@typescript-eslint/prefer-destructuring': 'off',
180
+ '@typescript-eslint/prefer-find': 'error',
181
+ '@typescript-eslint/prefer-for-of': 'error',
182
+ '@typescript-eslint/prefer-includes': 'error',
183
+ '@typescript-eslint/prefer-nullish-coalescing': 'error',
184
+ '@typescript-eslint/prefer-optional-chain': 'error',
185
+ '@typescript-eslint/prefer-regexp-exec': 'error',
186
+ '@typescript-eslint/prefer-string-starts-ends-with': 'error',
187
+ '@typescript-eslint/require-array-sort-compare': 'error',
188
+ '@typescript-eslint/unified-signatures': 'error',
189
+ },
190
+ },
191
+ )
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // @ts-check
2
+ export { default } from './configs/ts.js'
3
+ export { default as js } from './configs/js.js'
4
+ export { default as ts } from './configs/ts.js'
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@unix/eslint",
3
+ "version": "0.1.0",
4
+ "description": "ESLint config for all @unix projects.",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "author": "@unix",
8
+ "prettier": "@unix/prettier",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "exports": {
13
+ ".": "./index.js",
14
+ "./js": "./configs/js.js",
15
+ "./ts": "./configs/ts.js"
16
+ },
17
+ "files": [
18
+ "index.js",
19
+ "configs",
20
+ "package.json",
21
+ "LICENSE"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/unix/eslint"
26
+ },
27
+ "keywords": [
28
+ "eslint",
29
+ "eslint-config",
30
+ "unix"
31
+ ],
32
+ "sideEffects": false,
33
+ "peerDependencies": {
34
+ "eslint": ">=9.0.0",
35
+ "typescript": ">=4.8.4 <6.1.0"
36
+ },
37
+ "dependencies": {
38
+ "@eslint/js": "^10.0.1",
39
+ "@stylistic/eslint-plugin": "^5.10.0",
40
+ "typescript-eslint": "^8.59.2"
41
+ },
42
+ "devDependencies": {
43
+ "@unix/prettier": "^0.1.0",
44
+ "prettier": "^3.8.4"
45
+ },
46
+ "license": "MIT",
47
+ "scripts": {
48
+ "preview": "node scripts/preview.mjs",
49
+ "release": "pnpm publish --access public --no-git-checks"
50
+ }
51
+ }