@lbenie/linting 1.8.216 → 2.0.2
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/README.md +16 -29
- package/biome.jsonc +45 -0
- package/package.json +16 -37
- package/eslint/eslint.config.js +0 -182
- package/stylelint/stylelint.config.cjs +0 -18
package/README.md
CHANGED
|
@@ -1,39 +1,26 @@
|
|
|
1
1
|
# @lbenie/linting
|
|
2
2
|
|
|
3
|
-
My personal opinionated linting configuration for
|
|
3
|
+
My personal opinionated linting configuration for biome
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
Inside your project install the package
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export default [
|
|
25
|
-
...rules,
|
|
26
|
-
]
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Then create a `stylelint.config.cjs` file at the root of your project and add the following
|
|
30
|
-
|
|
31
|
-
```js
|
|
32
|
-
import rules from '@lbenie/linting/stylelint';
|
|
33
|
-
|
|
34
|
-
export default [
|
|
35
|
-
...rules,
|
|
36
|
-
]
|
|
9
|
+
| Package Manager | Command |
|
|
10
|
+
|-----------------|---------|
|
|
11
|
+
| npm | `npm i -D @lbenie/linting` |
|
|
12
|
+
| yarn | `yarn add -D @lbenie/linting` |
|
|
13
|
+
| pnpm | `pnpm add -D @lbenie/linting` |
|
|
14
|
+
| bun | `bun add -d @lbenie/linting` |
|
|
15
|
+
|
|
16
|
+
Then create a `biome.jsonc` file at the root of your project and add the following
|
|
17
|
+
|
|
18
|
+
```jsonc
|
|
19
|
+
{
|
|
20
|
+
"extends": [
|
|
21
|
+
"@lbenie/biome"
|
|
22
|
+
],
|
|
23
|
+
}
|
|
37
24
|
```
|
|
38
25
|
|
|
39
26
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
package/biome.jsonc
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.3.14/schema.json",
|
|
3
|
+
"linter": {
|
|
4
|
+
"rules": {
|
|
5
|
+
"recommended": true,
|
|
6
|
+
"correctness": {
|
|
7
|
+
"noUndeclaredVariables": "error"
|
|
8
|
+
},
|
|
9
|
+
"nursery": {
|
|
10
|
+
"noDeprecatedImports": "error",
|
|
11
|
+
"noDuplicateEnumValueNames": "error",
|
|
12
|
+
"noDuplicateEnumValues": "error",
|
|
13
|
+
"noImportCycles": "error",
|
|
14
|
+
"noShadow": "error",
|
|
15
|
+
"noUnnecessaryConditions": "error",
|
|
16
|
+
"noUnresolvedImports": "error",
|
|
17
|
+
"noUnusedExpressions": "error",
|
|
18
|
+
"noUselessCatchBinding": "error",
|
|
19
|
+
"noUselessUndefined": "error",
|
|
20
|
+
"useAwaitThenable": "error",
|
|
21
|
+
"useConsistentArrowReturn": "error",
|
|
22
|
+
"useExhaustiveSwitchCases": "error",
|
|
23
|
+
"useSpread": "error"
|
|
24
|
+
},
|
|
25
|
+
"performance": {
|
|
26
|
+
"noAwaitInLoops": "error",
|
|
27
|
+
"noBarrelFile": "error",
|
|
28
|
+
"noReExportAll": "error"
|
|
29
|
+
},
|
|
30
|
+
"style": {
|
|
31
|
+
"noCommonJs": "warn",
|
|
32
|
+
"noDefaultExport": "error",
|
|
33
|
+
"noDoneCallback": "error",
|
|
34
|
+
"noEnum": "error",
|
|
35
|
+
"noExportedImports": "error",
|
|
36
|
+
"noMagicNumbers": "error",
|
|
37
|
+
"useReactFunctionComponents": "error"
|
|
38
|
+
},
|
|
39
|
+
"suspicious": {
|
|
40
|
+
"noUnassignedVariables": "error"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"root": true
|
|
45
|
+
}
|
package/package.json
CHANGED
|
@@ -1,72 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lbenie/linting",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "my opiniated rules",
|
|
5
5
|
"repository": {
|
|
6
|
-
"url": "https://github.com/lbenie/linting"
|
|
6
|
+
"url": "git+https://github.com/lbenie/linting.git"
|
|
7
7
|
},
|
|
8
8
|
"keywords": [
|
|
9
|
-
"
|
|
10
|
-
"
|
|
9
|
+
"biome",
|
|
10
|
+
"lint",
|
|
11
11
|
"linting"
|
|
12
12
|
],
|
|
13
13
|
"type": "module",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"private": false,
|
|
16
16
|
"files": [
|
|
17
|
-
"
|
|
18
|
-
"stylelint"
|
|
17
|
+
"biome.jsonc"
|
|
19
18
|
],
|
|
20
|
-
"main": "./
|
|
19
|
+
"main": "./biome/biome.jsonc",
|
|
21
20
|
"exports": {
|
|
22
|
-
"./
|
|
23
|
-
"./stylelint": "./stylelint/stylelint.config.cjs"
|
|
21
|
+
"./biome": "./biome/biome.jsonc"
|
|
24
22
|
},
|
|
25
|
-
"types": "dist/types/index.d.ts",
|
|
26
23
|
"scripts": {
|
|
27
24
|
"test": "concurrently -n vitest 'vitest --coverage'",
|
|
28
25
|
"test:vitest": "vitest",
|
|
29
|
-
"lint": "
|
|
26
|
+
"lint": "biome check"
|
|
30
27
|
},
|
|
31
28
|
"publishConfig": {
|
|
32
29
|
"access": "public"
|
|
33
30
|
},
|
|
34
31
|
"devDependencies": {
|
|
35
|
-
"@eslint/js": "9.39.1",
|
|
36
32
|
"@semantic-release/changelog": "6.0.3",
|
|
37
33
|
"@semantic-release/commit-analyzer": "13.0.1",
|
|
38
34
|
"@semantic-release/git": "10.0.1",
|
|
39
|
-
"@semantic-release/github": "12.0.
|
|
40
|
-
"@semantic-release/npm": "13.1.
|
|
35
|
+
"@semantic-release/github": "12.0.5",
|
|
36
|
+
"@semantic-release/npm": "13.1.4",
|
|
41
37
|
"@semantic-release/release-notes-generator": "14.1.0",
|
|
42
|
-
"@types/react": "19.2.
|
|
43
|
-
"@types/semantic-release": "21.1.0",
|
|
38
|
+
"@types/react": "19.2.14",
|
|
44
39
|
"all-contributors-cli": "6.26.1",
|
|
45
|
-
"astro": "5.
|
|
46
|
-
"concurrently": "9.2.1",
|
|
40
|
+
"astro": "5.17.2",
|
|
47
41
|
"conventional-changelog-conventionalcommits": "9.1.0",
|
|
48
|
-
"lit": "3.3.
|
|
49
|
-
"react": "19.2.
|
|
50
|
-
"semantic-release": "25.0.
|
|
42
|
+
"lit": "3.3.2",
|
|
43
|
+
"react": "19.2.4",
|
|
44
|
+
"semantic-release": "25.0.3",
|
|
51
45
|
"tsutils": "3.21.0",
|
|
52
46
|
"typescript": "5.9.3"
|
|
53
47
|
},
|
|
54
48
|
"dependencies": {
|
|
55
|
-
"@
|
|
56
|
-
"@typescript-eslint/parser": "8.48.1",
|
|
57
|
-
"eslint": "9.39.1",
|
|
58
|
-
"eslint-plugin-astro": "1.5.0",
|
|
59
|
-
"eslint-plugin-functional": "9.0.2",
|
|
60
|
-
"eslint-plugin-jsdoc": "61.5.0",
|
|
61
|
-
"eslint-plugin-lit-a11y": "5.1.1",
|
|
62
|
-
"eslint-plugin-prettier": "5.5.4",
|
|
63
|
-
"globals": "16.5.0",
|
|
64
|
-
"postcss": "8.5.6",
|
|
65
|
-
"postcss-scss": "4.0.9",
|
|
66
|
-
"postcss-styl": "0.12.3",
|
|
67
|
-
"prettier": "3.7.4",
|
|
68
|
-
"stylelint": "16.26.1",
|
|
69
|
-
"stylelint-order": "7.0.0",
|
|
70
|
-
"stylelint-stylus": "1.0.0"
|
|
49
|
+
"@biomejs/biome": "2.3.14"
|
|
71
50
|
}
|
|
72
51
|
}
|
package/eslint/eslint.config.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js'
|
|
2
|
-
// import jsxA11y from 'eslint-plugin-jsx-a11y'
|
|
3
|
-
import globals from 'globals'
|
|
4
|
-
import jsdoc from 'eslint-plugin-jsdoc'
|
|
5
|
-
import tsElint from '@typescript-eslint/eslint-plugin'
|
|
6
|
-
import typescriptParser from '@typescript-eslint/parser'
|
|
7
|
-
import functional from 'eslint-plugin-functional'
|
|
8
|
-
import prettier from 'eslint-plugin-prettier'
|
|
9
|
-
import astroParser from 'astro-eslint-parser'
|
|
10
|
-
import astro from 'eslint-plugin-astro'
|
|
11
|
-
import litA11y from 'eslint-plugin-lit-a11y'
|
|
12
|
-
import { existsSync } from 'node:fs'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @type {Pick<import('eslint').Linter.FlatConfig, 'parserOptions' | 'ignores' | 'languageOptions'>}
|
|
16
|
-
*/
|
|
17
|
-
const defaultOptions = {
|
|
18
|
-
ignores: ['node_modules/*'],
|
|
19
|
-
languageOptions: {
|
|
20
|
-
sourceType: 'module',
|
|
21
|
-
globals: {
|
|
22
|
-
...globals.browser,
|
|
23
|
-
...globals.node,
|
|
24
|
-
},
|
|
25
|
-
parserOptions: {
|
|
26
|
-
ecmaVersion: 'latest',
|
|
27
|
-
sourceType: 'module',
|
|
28
|
-
experimentalObjectRestSpread: true,
|
|
29
|
-
ecmaFeatures: {
|
|
30
|
-
jsx: true,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @type {import('eslint').Linter.FlatConfig['plugins']}
|
|
38
|
-
*/
|
|
39
|
-
const defaultPlugins = {
|
|
40
|
-
functional,
|
|
41
|
-
jsdoc,
|
|
42
|
-
// 'jsx-a11y': jsxA11y,
|
|
43
|
-
'@typescript-eslint': tsElint,
|
|
44
|
-
prettier,
|
|
45
|
-
'lit-a11y': litA11y,
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @type {import('eslint').Linter.FlatConfig['rules']}
|
|
50
|
-
*/
|
|
51
|
-
const functionalrules = {
|
|
52
|
-
'functional/prefer-tacit': ['error'],
|
|
53
|
-
'functional/prefer-readonly-type': ['error'],
|
|
54
|
-
'functional/readonly-type': ['error', 'keyword'],
|
|
55
|
-
'functional/prefer-property-signatures': ['error'],
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* @type {import('eslint').Linter.FlatConfig['rules']}
|
|
60
|
-
*/
|
|
61
|
-
const prettierRules = {
|
|
62
|
-
'prettier/prettier': [
|
|
63
|
-
'error',
|
|
64
|
-
{ singleQuote: true, semi: false, trailingComma: 'all' },
|
|
65
|
-
],
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @type {import('eslint').Linter.FlatConfig['rules']}
|
|
70
|
-
*/
|
|
71
|
-
const tsRules = {
|
|
72
|
-
'@typescript-eslint/no-unused-vars': 'off',
|
|
73
|
-
'@typescript-eslint/consistent-type-imports': [
|
|
74
|
-
'error',
|
|
75
|
-
{ fixStyle: 'inline-type-imports' },
|
|
76
|
-
],
|
|
77
|
-
'@typescript-eslint/prefer-readonly': ['error'],
|
|
78
|
-
'@typescript-eslint/prefer-readonly-parameter-types': [
|
|
79
|
-
'error',
|
|
80
|
-
{ ignoreInferredTypes: true },
|
|
81
|
-
],
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @type {import('eslint').Linter.FlatConfig['rules']}
|
|
86
|
-
*/
|
|
87
|
-
const defaultRules = {
|
|
88
|
-
...functionalrules,
|
|
89
|
-
...prettierRules,
|
|
90
|
-
// ...jsxA11y.configs.recommended.rules,
|
|
91
|
-
...litA11y.configs.recommended.rules,
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @type {import('@typescript-eslint/parser').ParserOptions['project']}
|
|
96
|
-
* @returns {string[]} an array of paths to tsconfig files
|
|
97
|
-
*/
|
|
98
|
-
const defaultTsProjects = () => {
|
|
99
|
-
const paths = []
|
|
100
|
-
|
|
101
|
-
if (existsSync('./tsconfig.json')) {
|
|
102
|
-
paths.push('./tsconfig.json')
|
|
103
|
-
}
|
|
104
|
-
if (existsSync('./tsconfig.spec.json')) {
|
|
105
|
-
paths.push('./tsconfig.spec.json')
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return paths
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const project = defaultTsProjects()
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* @type {import('eslint').Linter.FlatConfig[]}
|
|
115
|
-
*/
|
|
116
|
-
const config = [
|
|
117
|
-
jsdoc.configs['flat/recommended'],
|
|
118
|
-
{
|
|
119
|
-
...defaultOptions,
|
|
120
|
-
files: ['**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs'],
|
|
121
|
-
rules: {
|
|
122
|
-
...js.configs.recommended.rules,
|
|
123
|
-
...defaultRules,
|
|
124
|
-
},
|
|
125
|
-
plugins: {
|
|
126
|
-
...defaultPlugins,
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
...defaultOptions,
|
|
131
|
-
files: ['**/*.ts', '**/*.tsx'],
|
|
132
|
-
rules: {
|
|
133
|
-
...defaultRules,
|
|
134
|
-
...tsElint.configs.recommended.rules,
|
|
135
|
-
...tsElint.configs['recommended-requiring-type-checking'].rules,
|
|
136
|
-
...tsRules,
|
|
137
|
-
},
|
|
138
|
-
languageOptions: {
|
|
139
|
-
...defaultOptions.languageOptions,
|
|
140
|
-
parser: typescriptParser,
|
|
141
|
-
parserOptions: {
|
|
142
|
-
...defaultOptions.languageOptions.parserOptions,
|
|
143
|
-
parser: typescriptParser,
|
|
144
|
-
project,
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
plugins: {
|
|
148
|
-
...defaultPlugins,
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
...defaultOptions,
|
|
153
|
-
files: ['**/*.astro', '**/*.astro/*.js', '*.astro/*.js'],
|
|
154
|
-
languageOptions: {
|
|
155
|
-
...defaultOptions.languageOptions,
|
|
156
|
-
globals: {
|
|
157
|
-
...defaultOptions.languageOptions.globals,
|
|
158
|
-
'astro/astro': true,
|
|
159
|
-
},
|
|
160
|
-
parser: astroParser,
|
|
161
|
-
parserOptions: {
|
|
162
|
-
...defaultOptions.languageOptions.parserOptions,
|
|
163
|
-
parser: typescriptParser,
|
|
164
|
-
project,
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
rules: {
|
|
168
|
-
...defaultRules,
|
|
169
|
-
...tsElint.configs.recommended.rules,
|
|
170
|
-
...tsElint.configs['recommended-requiring-type-checking'].rules,
|
|
171
|
-
...tsRules,
|
|
172
|
-
...astro.configs.recommended.rules,
|
|
173
|
-
'prettier/prettier': 'off',
|
|
174
|
-
},
|
|
175
|
-
plugins: {
|
|
176
|
-
...defaultPlugins,
|
|
177
|
-
astro,
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
]
|
|
181
|
-
|
|
182
|
-
export default config
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @type {import('stylelint').Config}
|
|
3
|
-
*/
|
|
4
|
-
module.exports = {
|
|
5
|
-
extends: ['stylelint-order'],
|
|
6
|
-
plugins: ['stylelint-stylus', 'stylelint-order'],
|
|
7
|
-
overrides: [
|
|
8
|
-
{
|
|
9
|
-
files: ['*.styl', '*.stylus'],
|
|
10
|
-
extends: ['stylelint-stylus/standard'],
|
|
11
|
-
customSyntax: 'postcss-styl',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
files: ['*.scss', '*.sass'],
|
|
15
|
-
customSyntax: 'postcss-scss',
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
}
|