@mouse_484/oxc-config 0.0.1 → 0.2.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/jsconfig.json +6 -0
- package/package.json +5 -2
- package/src/configs/eslint.js +19 -0
- package/src/configs/index.js +29 -0
- package/src/configs/oxc.js +8 -0
- package/src/configs/perfectionist.js +9 -0
- package/src/configs/stylistic.js +14 -0
- package/src/configs/tanstack-router.js +10 -0
- package/src/configs/type-aware.js +11 -0
- package/src/configs/typescript.js +8 -0
- package/src/index.d.ts +10 -0
- package/src/index.js +16 -1
package/jsconfig.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mouse_484/oxc-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"author": "mouse_484",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/mouse484/config/tree/main/packages/oxc",
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
},
|
|
15
15
|
"main": "src/index.js",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"
|
|
17
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
18
|
+
"eslint-plugin-perfectionist": "^5.10.0",
|
|
19
|
+
"oxlint": "^1.76.0",
|
|
20
|
+
"oxlint-tsgolint": "^7.0.2001"
|
|
18
21
|
},
|
|
19
22
|
"publishConfig": {
|
|
20
23
|
"access": "public"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from 'oxlint'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
rules: {
|
|
5
|
+
'eslint/id-length': ['off'],
|
|
6
|
+
'eslint/func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
7
|
+
'eslint/no-magic-numbers': ['error', { ignore: [0, 1, -1] }],
|
|
8
|
+
'eslint/no-undefined': ['off'],
|
|
9
|
+
'eslint/no-ternary': ['off'],
|
|
10
|
+
'eslint/no-nested-ternary': ['error'],
|
|
11
|
+
'eslint/no-unneeded-ternary': ['error'],
|
|
12
|
+
'eslint/no-void': ['error', { allowAsStatement: true }],
|
|
13
|
+
/**
|
|
14
|
+
* Prefer `perfectionist` plugin for sorting
|
|
15
|
+
*/
|
|
16
|
+
'eslint/sort-imports': ['off'],
|
|
17
|
+
'eslint/sort-keys': ['off'],
|
|
18
|
+
},
|
|
19
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import eslint from './eslint.js'
|
|
2
|
+
import oxc from './oxc.js'
|
|
3
|
+
import perfectionist from './perfectionist.js'
|
|
4
|
+
import stylistic from './stylistic.js'
|
|
5
|
+
import tanstackRouter from './tanstack-router.js'
|
|
6
|
+
import typeAware from './type-aware.js'
|
|
7
|
+
import typescript from './typescript.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @satisfies {Record<string, [boolean, import('oxlint').OxlintConfig ]>}
|
|
11
|
+
*/
|
|
12
|
+
const _configs = {
|
|
13
|
+
eslint: [true, eslint],
|
|
14
|
+
oxc: [true, oxc],
|
|
15
|
+
perfectionist: [true, perfectionist],
|
|
16
|
+
stylistic: [true, stylistic],
|
|
17
|
+
tanstackRouter: [false, tanstackRouter],
|
|
18
|
+
typeAware: [true, typeAware],
|
|
19
|
+
typescript: [true, typescript],
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @typedef {Partial<Record<keyof typeof _configs, boolean>>} ConfigOptions */
|
|
23
|
+
|
|
24
|
+
/** @param {ConfigOptions} [options] */
|
|
25
|
+
export default function configs(options = {}) {
|
|
26
|
+
return Object.entries(_configs).flatMap(([name, [defaultEnabled, config]]) => {
|
|
27
|
+
return (Object.hasOwn(options, name) ? options[/** @type {keyof ConfigOptions} */ (name)] : defaultEnabled) ? [config] : []
|
|
28
|
+
})
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import stylistic from '@stylistic/eslint-plugin'
|
|
2
|
+
import { defineConfig } from 'oxlint'
|
|
3
|
+
|
|
4
|
+
const { rules } = stylistic.configs.customize({
|
|
5
|
+
indent: 2,
|
|
6
|
+
quotes: 'single',
|
|
7
|
+
semi: false,
|
|
8
|
+
jsx: true,
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
jsPlugins: ['@stylistic/eslint-plugin'],
|
|
13
|
+
rules,
|
|
14
|
+
})
|
package/src/index.d.ts
ADDED
package/src/index.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import { defineConfig } from 'oxlint'
|
|
2
|
+
import configs from './configs/index.js'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/** @param {import('.').Options} [options] */
|
|
5
|
+
export function lint(options = {}) {
|
|
6
|
+
return defineConfig({
|
|
7
|
+
categories: {
|
|
8
|
+
correctness: 'error',
|
|
9
|
+
suspicious: 'warn',
|
|
10
|
+
pedantic: 'warn',
|
|
11
|
+
perf: 'warn',
|
|
12
|
+
style: 'warn',
|
|
13
|
+
restriction: 'warn',
|
|
14
|
+
nursery: 'warn',
|
|
15
|
+
},
|
|
16
|
+
extends: configs(options),
|
|
17
|
+
})
|
|
18
|
+
}
|