@vllnt/eslint-config 1.0.0-canary.74ff2a8

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.
@@ -0,0 +1,140 @@
1
+ export const typescriptConfig = {
2
+ rules: {
3
+ 'no-restricted-syntax': [
4
+ 'error',
5
+ {
6
+ selector: 'TSEnumDeclaration',
7
+ message: 'Prefer union type',
8
+ },
9
+ {
10
+ selector:
11
+ 'TSPropertySignature[optional=true] TSTypeAnnotation > TSUnionType > TSUndefinedKeyword',
12
+ message:
13
+ 'Optional properties already include undefined; drop the union and prefer `?:`.',
14
+ },
15
+ {
16
+ selector:
17
+ 'TSPropertySignature[optional=false] TSTypeAnnotation > TSUnionType > TSUndefinedKeyword',
18
+ message:
19
+ 'Use optional properties instead of unions with `undefined` (e.g. `email?: string`).',
20
+ },
21
+ ],
22
+ '@typescript-eslint/naming-convention': [
23
+ 'error',
24
+ {
25
+ selector: 'default',
26
+ format: ['camelCase'],
27
+ leadingUnderscore: 'allow',
28
+ trailingUnderscore: 'allow',
29
+ },
30
+ {
31
+ selector: 'import',
32
+ format: ['camelCase', 'PascalCase'],
33
+ },
34
+ {
35
+ selector: 'variable',
36
+ format: ['camelCase', 'UPPER_CASE'],
37
+ leadingUnderscore: 'allow',
38
+ trailingUnderscore: 'allow',
39
+ },
40
+ {
41
+ selector: ['variableLike'],
42
+ format: ['camelCase'],
43
+ leadingUnderscore: 'allow',
44
+ trailingUnderscore: 'allow',
45
+ },
46
+ {
47
+ selector: 'typeLike',
48
+ format: ['PascalCase'],
49
+ custom: {
50
+ regex: '^(I|T)[A-Z]',
51
+ match: false,
52
+ },
53
+ },
54
+ {
55
+ selector: 'typeParameter',
56
+ format: ['PascalCase'],
57
+ prefix: ['T'],
58
+ },
59
+ {
60
+ selector: 'enumMember',
61
+ format: ['camelCase', 'UPPER_CASE'],
62
+ },
63
+ {
64
+ selector: 'objectLiteralProperty',
65
+ format: null,
66
+ filter: {
67
+ regex: '^/',
68
+ match: true,
69
+ },
70
+ },
71
+ ],
72
+ '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
73
+ '@typescript-eslint/prefer-readonly': 'error',
74
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
75
+ '@typescript-eslint/no-explicit-any': 'error',
76
+ '@typescript-eslint/no-import-type-side-effects': 'error',
77
+ '@typescript-eslint/array-type': 'error',
78
+ '@typescript-eslint/dot-notation': 'error',
79
+ '@typescript-eslint/consistent-indexed-object-style': 'error',
80
+ '@typescript-eslint/prefer-optional-chain': 'error',
81
+ '@typescript-eslint/no-unnecessary-type-assertion': 'error',
82
+ '@typescript-eslint/consistent-generic-constructors': 'error',
83
+ 'require-await': 'off',
84
+ '@typescript-eslint/require-await': 'error',
85
+ 'no-unused-vars': 'off',
86
+ '@typescript-eslint/no-unused-vars': [
87
+ 'error',
88
+ { argsIgnorePattern: '^_', ignoreRestSiblings: true },
89
+ ],
90
+ '@typescript-eslint/ban-ts-comment': [
91
+ 'error',
92
+ { 'ts-ignore': 'allow-with-description' },
93
+ ],
94
+ '@typescript-eslint/unbound-method': 'off',
95
+ '@typescript-eslint/prefer-nullish-coalescing': 'off',
96
+ '@typescript-eslint/explicit-function-return-type': 'off',
97
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
98
+ '@typescript-eslint/no-unsafe-assignment': 'off',
99
+ '@typescript-eslint/no-extraneous-class': 'off',
100
+ '@typescript-eslint/no-base-to-string': 'off',
101
+ '@typescript-eslint/no-unnecessary-condition': 'off',
102
+ },
103
+ }
104
+
105
+ export const typescriptTsx = {
106
+ files: ['**/*.tsx'],
107
+ rules: {
108
+ '@typescript-eslint/no-misused-promises': 'off',
109
+ '@typescript-eslint/require-await': 'off',
110
+ '@typescript-eslint/naming-convention': [
111
+ 'error',
112
+ {
113
+ selector: ['function'],
114
+ format: ['camelCase', 'PascalCase'],
115
+ leadingUnderscore: 'allow',
116
+ trailingUnderscore: 'allow',
117
+ },
118
+ ],
119
+ },
120
+ }
121
+
122
+ export const typescriptTest = {
123
+ files: ['**/*.test.ts', '**/*.spec.ts', '**/*.e2e.ts'],
124
+ rules: {
125
+ '@typescript-eslint/no-unsafe-member-access': 'off',
126
+ },
127
+ }
128
+
129
+ export const typescriptDecorator = {
130
+ files: ['**/*.decorator.ts'],
131
+ rules: {
132
+ '@typescript-eslint/naming-convention': [
133
+ 'error',
134
+ {
135
+ selector: ['function'],
136
+ format: ['camelCase', 'PascalCase'],
137
+ },
138
+ ],
139
+ },
140
+ }
@@ -0,0 +1,165 @@
1
+ import unicornPlugin from 'eslint-plugin-unicorn'
2
+
3
+ export const unicornConfig = {
4
+ plugins: {
5
+ unicorn: unicornPlugin,
6
+ },
7
+ rules: {
8
+ 'unicorn/better-regex': 'error',
9
+ 'unicorn/catch-error-name': 'error',
10
+ 'unicorn/consistent-destructuring': 'error',
11
+ 'unicorn/consistent-function-scoping': 'error',
12
+ 'unicorn/custom-error-definition': 'off',
13
+ 'unicorn/empty-brace-spaces': 'error',
14
+ 'unicorn/error-message': 'error',
15
+ 'unicorn/escape-case': 'error',
16
+ 'unicorn/expiring-todo-comments': 'off',
17
+ 'unicorn/explicit-length-check': 'error',
18
+ 'unicorn/filename-case': 'error',
19
+ 'unicorn/import-style': 'off',
20
+ 'unicorn/new-for-builtins': 'error',
21
+ 'unicorn/no-abusive-eslint-disable': 'error',
22
+ 'unicorn/no-array-callback-reference': 'off',
23
+ 'unicorn/no-array-for-each': 'off',
24
+ 'unicorn/no-array-method-this-argument': 'error',
25
+ 'unicorn/no-array-push-push': 'error',
26
+ 'unicorn/no-array-reduce': 'off',
27
+ 'unicorn/no-await-expression-member': 'error',
28
+ 'unicorn/no-console-spaces': 'error',
29
+ 'unicorn/no-document-cookie': 'error',
30
+ 'unicorn/no-empty-file': 'error',
31
+ 'unicorn/no-for-loop': 'error',
32
+ 'unicorn/no-hex-escape': 'error',
33
+ 'unicorn/no-instanceof-array': 'error',
34
+ 'unicorn/no-invalid-remove-event-listener': 'error',
35
+ 'unicorn/no-keyword-prefix': 'off',
36
+ 'unicorn/no-lonely-if': 'error',
37
+ 'no-negated-condition': 'off',
38
+ 'unicorn/no-negated-condition': 'error',
39
+ 'no-nested-ternary': 'off',
40
+ 'unicorn/no-nested-ternary': 'error',
41
+ 'unicorn/no-new-array': 'error',
42
+ 'unicorn/no-new-buffer': 'error',
43
+ 'unicorn/no-null': 'error',
44
+ 'unicorn/no-object-as-default-parameter': 'error',
45
+ 'unicorn/no-process-exit': 'error',
46
+ 'unicorn/no-static-only-class': 'error',
47
+ 'unicorn/no-thenable': 'error',
48
+ 'unicorn/no-this-assignment': 'error',
49
+ 'unicorn/no-typeof-undefined': 'error',
50
+ 'unicorn/no-unnecessary-await': 'error',
51
+ 'unicorn/no-unreadable-array-destructuring': 'error',
52
+ 'unicorn/no-unreadable-iife': 'error',
53
+ 'unicorn/no-unused-properties': 'off',
54
+ 'unicorn/no-useless-fallback-in-spread': 'error',
55
+ 'unicorn/no-useless-length-check': 'error',
56
+ 'unicorn/no-useless-promise-resolve-reject': 'error',
57
+ 'unicorn/no-useless-spread': 'error',
58
+ 'unicorn/no-useless-switch-case': 'error',
59
+ 'unicorn/no-useless-undefined': 'error',
60
+ 'unicorn/no-zero-fractions': 'error',
61
+ 'unicorn/number-literal-case': 'error',
62
+ 'unicorn/numeric-separators-style': 'error',
63
+ 'unicorn/prefer-add-event-listener': 'error',
64
+ 'unicorn/prefer-array-find': 'error',
65
+ 'unicorn/prefer-array-flat': 'error',
66
+ 'unicorn/prefer-array-flat-map': 'error',
67
+ 'unicorn/prefer-array-index-of': 'error',
68
+ 'unicorn/prefer-array-some': 'error',
69
+ 'unicorn/prefer-at': 'error',
70
+ 'unicorn/prefer-blob-reading-methods': 'error',
71
+ 'unicorn/prefer-code-point': 'error',
72
+ 'unicorn/prefer-date-now': 'error',
73
+ 'unicorn/prefer-default-parameters': 'error',
74
+ 'unicorn/prefer-dom-node-append': 'error',
75
+ 'unicorn/prefer-dom-node-dataset': 'error',
76
+ 'unicorn/prefer-dom-node-remove': 'error',
77
+ 'unicorn/prefer-dom-node-text-content': 'error',
78
+ 'unicorn/prefer-event-target': 'error',
79
+ 'unicorn/prefer-export-from': 'error',
80
+ 'unicorn/prefer-includes': 'error',
81
+ 'unicorn/prefer-json-parse-buffer': 'error',
82
+ 'unicorn/prefer-keyboard-event-key': 'error',
83
+ 'unicorn/prefer-logical-operator-over-ternary': 'error',
84
+ 'unicorn/prefer-math-trunc': 'error',
85
+ 'unicorn/prefer-modern-dom-apis': 'error',
86
+ 'unicorn/prefer-modern-math-apis': 'error',
87
+ 'unicorn/prefer-module': 'error',
88
+ 'unicorn/prefer-native-coercion-functions': 'error',
89
+ 'unicorn/prefer-negative-index': 'error',
90
+ 'unicorn/prefer-node-protocol': 'error',
91
+ 'unicorn/prefer-number-properties': 'error',
92
+ 'unicorn/prefer-object-from-entries': 'error',
93
+ 'unicorn/prefer-optional-catch-binding': 'error',
94
+ 'unicorn/prefer-prototype-methods': 'error',
95
+ 'unicorn/prefer-query-selector': 'error',
96
+ 'unicorn/prefer-reflect-apply': 'error',
97
+ 'unicorn/prefer-regexp-test': 'error',
98
+ 'unicorn/prefer-set-has': 'error',
99
+ 'unicorn/prefer-set-size': 'error',
100
+ 'unicorn/prefer-spread': 'error',
101
+ 'unicorn/prefer-string-replace-all': 'error',
102
+ 'unicorn/prefer-string-slice': 'error',
103
+ 'unicorn/prefer-string-starts-ends-with': 'error',
104
+ 'unicorn/prefer-string-trim-start-end': 'error',
105
+ 'unicorn/prefer-switch': 'error',
106
+ 'unicorn/prefer-ternary': 'error',
107
+ 'unicorn/prefer-top-level-await': 'error',
108
+ 'unicorn/prefer-type-error': 'error',
109
+ 'unicorn/prevent-abbreviations': [
110
+ 'error',
111
+ {
112
+ extendDefaultReplacements: true,
113
+ replacements: {
114
+ ctx: false,
115
+ db: false,
116
+ e: false,
117
+ fn: false,
118
+ props: false,
119
+ ref: false,
120
+ utils: false,
121
+ },
122
+ ignore: [
123
+ 'e2e',
124
+ 'a11y',
125
+ 'i18n',
126
+ 'getInitialProps',
127
+ 'generateStaticParams',
128
+ 'dynamicParams',
129
+ '.*Ctx$',
130
+ '.*Ref$',
131
+ ],
132
+ },
133
+ ],
134
+ 'unicorn/relative-url-style': 'error',
135
+ 'unicorn/require-array-join-separator': 'error',
136
+ 'unicorn/require-number-to-fixed-digits-argument': 'error',
137
+ 'unicorn/require-post-message-target-origin': 'off',
138
+ 'unicorn/string-content': 'off',
139
+ 'unicorn/switch-case-braces': ['error', 'avoid'],
140
+ 'unicorn/template-indent': 'error',
141
+ 'unicorn/text-encoding-identifier-case': 'error',
142
+ 'unicorn/throw-new-error': 'error',
143
+ },
144
+ }
145
+
146
+ export const unicornTsx = {
147
+ files: ['**/*.tsx'],
148
+ rules: {
149
+ 'unicorn/no-null': 'off',
150
+ 'unicorn/no-nested-ternary': 'off',
151
+ },
152
+ }
153
+
154
+ export const unicornFilename = {
155
+ files: [
156
+ '**/*.tsx',
157
+ '**/*.animations.ts',
158
+ '**/*.settings.ts',
159
+ '**/*.stories.ts',
160
+ '**/*.types.ts',
161
+ ],
162
+ rules: {
163
+ 'unicorn/filename-case': 'off',
164
+ },
165
+ }
package/flat/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { nextjs } from './nextjs.js'
2
+ export { convex } from './convex.js'
3
+ export { nodejs } from './nodejs.js'
4
+ export { react } from './react.js'
5
+ export { base } from './base.js'
6
+ export { turbo } from './turbo.js'
7
+ export { boundaries } from './boundaries.js'
package/flat/nextjs.js ADDED
@@ -0,0 +1,83 @@
1
+ import eslint from '@eslint/js'
2
+ import tseslint from 'typescript-eslint'
3
+ import nextPlugin from '@next/eslint-plugin-next'
4
+ import { goodPractices, goodPracticesTsx, goodPracticesTest } from './core/good-practices.js'
5
+ import { imports } from './core/imports.js'
6
+ import { format } from './core/format.js'
7
+ import { unicornConfig, unicornTsx, unicornFilename } from './core/unicorn.js'
8
+ import {
9
+ typescriptConfig,
10
+ typescriptTsx,
11
+ typescriptTest,
12
+ typescriptDecorator,
13
+ } from './core/typescript.js'
14
+ import { reactConfig } from './core/react.js'
15
+
16
+ export const nextjs = tseslint.config(
17
+ eslint.configs.recommended,
18
+ ...tseslint.configs.strictTypeChecked,
19
+ ...tseslint.configs.stylisticTypeChecked,
20
+ {
21
+ languageOptions: {
22
+ parserOptions: {
23
+ projectService: true,
24
+ },
25
+ },
26
+ },
27
+ {
28
+ plugins: {
29
+ '@next/next': nextPlugin,
30
+ },
31
+ rules: {
32
+ ...Object.fromEntries(
33
+ Object.entries({
34
+ ...nextPlugin.configs.recommended.rules,
35
+ ...nextPlugin.configs['core-web-vitals'].rules,
36
+ }).map(([rule, config]) => [
37
+ rule,
38
+ config === 'warn' ? 'error' : config,
39
+ ]),
40
+ ),
41
+ },
42
+ },
43
+ goodPractices,
44
+ goodPracticesTsx,
45
+ goodPracticesTest,
46
+ imports,
47
+ format,
48
+ unicornConfig,
49
+ unicornTsx,
50
+ unicornFilename,
51
+ typescriptConfig,
52
+ typescriptTsx,
53
+ typescriptTest,
54
+ typescriptDecorator,
55
+ reactConfig,
56
+ {
57
+ files: ['**/app/**/page.{js,jsx,ts,tsx}', '**/app/**/layout.{js,jsx,ts,tsx}'],
58
+ rules: {
59
+ 'max-lines-per-function': 'off',
60
+ },
61
+ },
62
+ {
63
+ files: ['**/app/api/**/route.{js,jsx,ts,tsx}'],
64
+ rules: {
65
+ '@typescript-eslint/naming-convention': 'off',
66
+ 'no-restricted-syntax': [
67
+ 'error',
68
+ {
69
+ selector:
70
+ 'ExportNamedDeclaration > FunctionDeclaration:not([id.name=/^(GET|POST|PUT|DELETE)$/])',
71
+ message: 'Only GET, POST, PUT, DELETE are allowed as exported route handlers in route.ts',
72
+ },
73
+ {
74
+ selector:
75
+ 'ExportNamedDeclaration > VariableDeclaration > VariableDeclarator[init.type=/^(ArrowFunctionExpression|FunctionExpression)$/]:not([id.name=/^(GET|POST|PUT|DELETE)$/])',
76
+ message: 'Only GET, POST, PUT, DELETE are allowed as exported route handlers in route.ts',
77
+ },
78
+ ],
79
+ },
80
+ },
81
+ )
82
+
83
+ export default nextjs
package/flat/nodejs.js ADDED
@@ -0,0 +1,31 @@
1
+ import eslint from '@eslint/js'
2
+ import tseslint from 'typescript-eslint'
3
+ import { goodPractices, goodPracticesTest } from './core/good-practices.js'
4
+ import { imports } from './core/imports.js'
5
+ import { format } from './core/format.js'
6
+ import { unicornConfig, unicornFilename } from './core/unicorn.js'
7
+ import { typescriptConfig, typescriptTest, typescriptDecorator } from './core/typescript.js'
8
+
9
+ export const nodejs = tseslint.config(
10
+ eslint.configs.recommended,
11
+ ...tseslint.configs.strictTypeChecked,
12
+ ...tseslint.configs.stylisticTypeChecked,
13
+ {
14
+ languageOptions: {
15
+ parserOptions: {
16
+ projectService: true,
17
+ },
18
+ },
19
+ },
20
+ goodPractices,
21
+ goodPracticesTest,
22
+ imports,
23
+ format,
24
+ unicornConfig,
25
+ unicornFilename,
26
+ typescriptConfig,
27
+ typescriptTest,
28
+ typescriptDecorator,
29
+ )
30
+
31
+ export default nodejs
package/flat/react.js ADDED
@@ -0,0 +1,36 @@
1
+ import eslint from '@eslint/js'
2
+ import tseslint from 'typescript-eslint'
3
+ import { goodPractices, goodPracticesTsx, goodPracticesTest } from './core/good-practices.js'
4
+ import { imports } from './core/imports.js'
5
+ import { format } from './core/format.js'
6
+ import { unicornConfig, unicornTsx, unicornFilename } from './core/unicorn.js'
7
+ import { typescriptConfig, typescriptTsx, typescriptTest, typescriptDecorator } from './core/typescript.js'
8
+ import { reactConfig } from './core/react.js'
9
+
10
+ export const react = tseslint.config(
11
+ eslint.configs.recommended,
12
+ ...tseslint.configs.strictTypeChecked,
13
+ ...tseslint.configs.stylisticTypeChecked,
14
+ {
15
+ languageOptions: {
16
+ parserOptions: {
17
+ projectService: true,
18
+ },
19
+ },
20
+ },
21
+ goodPractices,
22
+ goodPracticesTsx,
23
+ goodPracticesTest,
24
+ imports,
25
+ format,
26
+ unicornConfig,
27
+ unicornTsx,
28
+ unicornFilename,
29
+ typescriptConfig,
30
+ typescriptTsx,
31
+ typescriptTest,
32
+ typescriptDecorator,
33
+ reactConfig,
34
+ )
35
+
36
+ export default react
package/flat/turbo.js ADDED
@@ -0,0 +1,14 @@
1
+ import turboPlugin from 'eslint-plugin-turbo'
2
+
3
+ export const turbo = [
4
+ {
5
+ plugins: {
6
+ turbo: turboPlugin,
7
+ },
8
+ rules: {
9
+ ...turboPlugin.configs.recommended.rules,
10
+ },
11
+ },
12
+ ]
13
+
14
+ export default turbo
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@vllnt/eslint-config",
3
+ "version": "1.0.0-canary.74ff2a8",
4
+ "type": "module",
5
+ "description": "Strict ESLint config for TypeScript projects. All rules enforce error — no warnings.",
6
+ "license": "MIT",
7
+ "main": "./flat/index.js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/vllnt/eslint-config"
11
+ },
12
+ "keywords": [
13
+ "eslint",
14
+ "eslint-config",
15
+ "typescript",
16
+ "react",
17
+ "nextjs",
18
+ "prettier"
19
+ ],
20
+ "engines": {
21
+ "node": ">=20"
22
+ },
23
+ "packageManager": "pnpm@10.28.2",
24
+ "files": [
25
+ "flat"
26
+ ],
27
+ "exports": {
28
+ ".": "./flat/index.js",
29
+ "./nextjs": "./flat/nextjs.js",
30
+ "./nodejs": "./flat/nodejs.js",
31
+ "./convex": "./flat/convex.js",
32
+ "./react": "./flat/react.js",
33
+ "./turbo": "./flat/turbo.js",
34
+ "./boundaries": "./flat/boundaries.js",
35
+ "./package.json": "./package.json"
36
+ },
37
+ "scripts": {
38
+ "test": "node --test tests/smoke.test.js",
39
+ "prepublishOnly": "node --test tests/smoke.test.js"
40
+ },
41
+ "dependencies": {
42
+ "@convex-dev/eslint-plugin": "^1.1.1",
43
+ "@eslint/js": "^9.39.2",
44
+ "@next/eslint-plugin-next": "^16.1.6",
45
+ "eslint-config-prettier": "^10.1.8",
46
+ "eslint-plugin-boundaries": "^5.4.0",
47
+ "eslint-plugin-css-modules": "^2.12.0",
48
+ "eslint-plugin-functional": "^9.0.2",
49
+ "eslint-plugin-jsx-a11y": "^6.10.2",
50
+ "eslint-plugin-perfectionist": "^5.6.0",
51
+ "eslint-plugin-prettier": "^5.5.5",
52
+ "eslint-plugin-react": "^7.37.5",
53
+ "eslint-plugin-react-hooks": "^7.0.1",
54
+ "eslint-plugin-simple-import-sort": "^12.1.1",
55
+ "eslint-plugin-turbo": "^2.8.10",
56
+ "eslint-plugin-unicorn": "^62.0.0",
57
+ "eslint-plugin-write-good-comments": "^0.2.0",
58
+ "typescript-eslint": "^8.56.0"
59
+ },
60
+ "peerDependencies": {
61
+ "eslint": ">=9",
62
+ "prettier": ">=3",
63
+ "typescript": ">=5"
64
+ },
65
+ "peerDependenciesMeta": {
66
+ "typescript": {
67
+ "optional": true
68
+ }
69
+ },
70
+ "publishConfig": {
71
+ "access": "public",
72
+ "registry": "https://registry.npmjs.org/"
73
+ },
74
+ "devDependencies": {
75
+ "eslint": "^9.39.2",
76
+ "typescript": "^5.9.3"
77
+ }
78
+ }