@ocavue/eslint-config 1.0.0 → 1.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/README.md +6 -0
- package/dist/src/antfu.d.ts +2 -0
- package/dist/src/antfu.d.ts.map +1 -0
- package/dist/src/basic.d.ts +7 -0
- package/dist/src/basic.d.ts.map +1 -1
- package/dist/src/imports.d.ts.map +1 -1
- package/dist/src/markdown.d.ts.map +1 -1
- package/dist/src/no-only-tests.d.ts.map +1 -1
- package/dist/src/package-json.d.ts +3 -0
- package/dist/src/package-json.d.ts.map +1 -1
- package/dist/src/prettier.d.ts +6 -0
- package/dist/src/prettier.d.ts.map +1 -1
- package/dist/src/react.d.ts.map +1 -1
- package/dist/src/typescript.d.ts +8 -0
- package/dist/src/typescript.d.ts.map +1 -1
- package/dist/src/unicorn.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/antfu.js +17 -0
- package/src/basic.js +3 -1
- package/src/imports.js +1 -1
- package/src/markdown.js +1 -1
- package/src/no-only-tests.js +1 -1
- package/src/package-json.js +1 -1
- package/src/prettier.js +1 -1
- package/src/react.js +1 -1
- package/src/typescript.js +1 -1
- package/src/unicorn.js +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ A set of ESLint shareable configs for TypeScript projects.
|
|
|
5
5
|
- Out of the box support for TypeScript, React, and Markdown
|
|
6
6
|
- Sort your imports
|
|
7
7
|
- Sort your fields in `package.json`
|
|
8
|
+
- Prefer top-level function declarations over function expressions
|
|
8
9
|
|
|
9
10
|
## Install
|
|
10
11
|
|
|
@@ -75,3 +76,8 @@ If you are using VS Code, you and install [ESLint extension](https://marketplace
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
```
|
|
79
|
+
|
|
80
|
+
## Inspired by
|
|
81
|
+
|
|
82
|
+
- https://github.com/antfu/eslint-config
|
|
83
|
+
- https://github.com/sxzz/eslint-config
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antfu.d.ts","sourceRoot":"","sources":["../../src/antfu.js"],"names":[],"mappings":"AAEA,+EAcC"}
|
package/dist/src/basic.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} BasicOptions
|
|
3
|
+
* @property {import('./typescript.js').TypescriptOptions} [typescript]
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @param {BasicOptions} [options]
|
|
7
|
+
*/
|
|
1
8
|
export function basic(options?: BasicOptions | undefined): import("eslint-define-config").FlatESLintConfigItem[];
|
|
2
9
|
export type BasicOptions = {
|
|
3
10
|
typescript?: import("./typescript.js").TypescriptOptions | undefined;
|
package/dist/src/basic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/basic.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/basic.js"],"names":[],"mappings":"AAWA;;;GAGG;AAEH;;GAEG;AACH,iHAiBC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/imports.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/imports.js"],"names":[],"mappings":"AAKA,iFA0CC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/markdown.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/markdown.js"],"names":[],"mappings":"AAOA,kFA0DC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-only-tests.d.ts","sourceRoot":"","sources":["../../src/no-only-tests.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"no-only-tests.d.ts","sourceRoot":"","sources":["../../src/no-only-tests.js"],"names":[],"mappings":"AAKA,qFAcC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../src/package-json.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../src/package-json.js"],"names":[],"mappings":"AAOA;;GAEG;AACH,qFA0EC"}
|
package/dist/src/prettier.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns off all rules that are unnecessary or might conflict with Prettier.
|
|
3
|
+
*
|
|
4
|
+
* Notice that this config does not run `prettier` as an ESLint rule, so you
|
|
5
|
+
* have to run `pretter` separately for formatting.
|
|
6
|
+
*/
|
|
1
7
|
export function prettier(): import("eslint-define-config").FlatESLintConfigItem[];
|
|
2
8
|
//# sourceMappingURL=prettier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../../src/prettier.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prettier.d.ts","sourceRoot":"","sources":["../../src/prettier.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,kFAWC"}
|
package/dist/src/react.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/react.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/react.js"],"names":[],"mappings":"AASA,+EAwCC"}
|
package/dist/src/typescript.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} TypescriptOptions
|
|
3
|
+
* @property {string | false} [project] - Path to tsconfig.json, defaults
|
|
4
|
+
* to './tsconfig.json'. You can pass `false` to disable the tsconfig.json check.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @param {TypescriptOptions} [options]
|
|
8
|
+
*/
|
|
1
9
|
export function typescript(options?: TypescriptOptions | undefined): import("eslint-define-config").FlatESLintConfigItem[];
|
|
2
10
|
export type TypescriptOptions = {
|
|
3
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/typescript.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/typescript.js"],"names":[],"mappings":"AASA;;;;GAIG;AAEH;;GAEG;AACH,2HAsEC;;;;;;;;qBArFoB,2BAA2B;qBAD3B,kCAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../src/unicorn.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../src/unicorn.js"],"names":[],"mappings":"AAKA,iFA+DC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocavue/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"packageManager": "pnpm@8.5.1",
|
|
6
6
|
"description": "",
|
|
7
7
|
"author": "ocavue <ocavue@gmail.com>",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"eslint-config-prettier": "^8.8.0",
|
|
38
38
|
"eslint-define-config": "^1.20.0",
|
|
39
39
|
"eslint-import-resolver-typescript": "^3.5.5",
|
|
40
|
+
"eslint-plugin-antfu": "^0.39.3",
|
|
40
41
|
"eslint-plugin-import": "^2.27.5",
|
|
41
42
|
"eslint-plugin-jsonc": "^2.8.0",
|
|
42
43
|
"eslint-plugin-markdown": "^3.0.0",
|
package/src/antfu.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import antfuPlugin from 'eslint-plugin-antfu'
|
|
2
|
+
|
|
3
|
+
export function antfu() {
|
|
4
|
+
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
5
|
+
const config = [
|
|
6
|
+
{
|
|
7
|
+
plugins: {
|
|
8
|
+
antfu: antfuPlugin,
|
|
9
|
+
},
|
|
10
|
+
rules: {
|
|
11
|
+
'antfu/top-level-function': 'error',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
return config
|
|
17
|
+
}
|
package/src/basic.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
import { antfu } from './antfu.js'
|
|
3
4
|
import { imports } from './imports.js'
|
|
4
5
|
import { noOnlyTests } from './no-only-tests.js'
|
|
5
6
|
import { packageJson } from './package-json.js'
|
|
@@ -16,7 +17,7 @@ import { unicorn } from './unicorn.js'
|
|
|
16
17
|
/**
|
|
17
18
|
* @param {BasicOptions} [options]
|
|
18
19
|
*/
|
|
19
|
-
export
|
|
20
|
+
export function basic(options) {
|
|
20
21
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
21
22
|
const config = [
|
|
22
23
|
{
|
|
@@ -27,6 +28,7 @@ export const basic = (options) => {
|
|
|
27
28
|
...imports(),
|
|
28
29
|
...packageJson(),
|
|
29
30
|
...unicorn(),
|
|
31
|
+
...antfu(),
|
|
30
32
|
...noOnlyTests(),
|
|
31
33
|
...prettier(),
|
|
32
34
|
]
|
package/src/imports.js
CHANGED
package/src/markdown.js
CHANGED
|
@@ -5,7 +5,7 @@ import markdownPlugin from 'eslint-plugin-markdown'
|
|
|
5
5
|
|
|
6
6
|
import { GLOB_MARKDOWN, GLOB_SRC, GLOB_VUE } from './shared.js'
|
|
7
7
|
|
|
8
|
-
export
|
|
8
|
+
export function markdown() {
|
|
9
9
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
10
10
|
const config = [
|
|
11
11
|
{
|
package/src/no-only-tests.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// @ts-expect-error: eslint-plugin-unicorn is not typed
|
|
4
4
|
import plugin from 'eslint-plugin-no-only-tests'
|
|
5
5
|
|
|
6
|
-
export
|
|
6
|
+
export function noOnlyTests() {
|
|
7
7
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
8
8
|
const config = [
|
|
9
9
|
{
|
package/src/package-json.js
CHANGED
package/src/prettier.js
CHANGED
|
@@ -6,7 +6,7 @@ import prettierConfig from 'eslint-config-prettier'
|
|
|
6
6
|
* Notice that this config does not run `prettier` as an ESLint rule, so you
|
|
7
7
|
* have to run `pretter` separately for formatting.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export function prettier() {
|
|
10
10
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
11
11
|
const config = [
|
|
12
12
|
{
|
package/src/react.js
CHANGED
package/src/typescript.js
CHANGED
|
@@ -16,7 +16,7 @@ export { tsParser, tsPlugin }
|
|
|
16
16
|
/**
|
|
17
17
|
* @param {TypescriptOptions} [options]
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export function typescript(options) {
|
|
20
20
|
const project = options?.project ?? './tsconfig.json'
|
|
21
21
|
|
|
22
22
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
package/src/unicorn.js
CHANGED