@icebreakers/eslint-config 0.0.3 → 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/README.md +34 -0
- package/dist/antfu.cjs +9 -0
- package/dist/antfu.d.cts +1 -0
- package/dist/antfu.d.mts +1 -0
- package/dist/antfu.d.ts +1 -0
- package/dist/antfu.mjs +1 -0
- package/dist/index.cjs +28 -14
- package/dist/index.d.cts +8 -7
- package/dist/index.d.mts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.mjs +25 -14
- package/package.json +30 -7
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# @icebreakers/eslint-config
|
|
2
|
+
|
|
3
|
+
> extend [@antfu/eslint-config](https://www.npmjs.com/package/@antfu/eslint-config) and add `prettier` support!
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm i -D eslint @icebreakers/eslint-config
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// eslint.config.mjs
|
|
13
|
+
import { icebreaker } from '@icebreakers/eslint-config'
|
|
14
|
+
|
|
15
|
+
export default icebreaker()
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or use with `prettier`:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// eslint.config.mjs
|
|
22
|
+
import { icebreaker } from '@icebreakers/eslint-config'
|
|
23
|
+
|
|
24
|
+
export default icebreaker({
|
|
25
|
+
prettier: true,
|
|
26
|
+
stylistic: false,
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## VS Code support
|
|
31
|
+
|
|
32
|
+
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
33
|
+
|
|
34
|
+
Version: `^3.0.5` ( >=`3.0.5`)
|
package/dist/antfu.cjs
ADDED
package/dist/antfu.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@antfu/eslint-config';
|
package/dist/antfu.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@antfu/eslint-config';
|
package/dist/antfu.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@antfu/eslint-config';
|
package/dist/antfu.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@antfu/eslint-config';
|
package/dist/index.cjs
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
|
|
4
|
+
const eslintrc = require('@eslint/eslintrc');
|
|
5
|
+
const localPkg = require('local-pkg');
|
|
6
|
+
const eslintConfig = require('@antfu/eslint-config');
|
|
5
7
|
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
9
|
+
|
|
10
|
+
const eslintPluginPrettierRecommended__default = /*#__PURE__*/_interopDefaultCompat(eslintPluginPrettierRecommended);
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const compat = new eslintrc.FlatCompat();
|
|
13
|
+
function icebreaker(options = {}, ...userConfigs) {
|
|
14
|
+
const { prettier, tailwindcss: enableTailwindcss = localPkg.isPackageExists("tailwindcss"), ...opts } = options;
|
|
15
|
+
const presets = [
|
|
16
|
+
{
|
|
17
|
+
rules: {
|
|
18
|
+
"curly": ["error", "all"],
|
|
19
|
+
"no-console": ["warn"],
|
|
20
|
+
"ts/prefer-ts-expect-error": "off",
|
|
21
|
+
"ts/ban-ts-comment": "off"
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
|
-
|
|
24
|
+
];
|
|
25
|
+
if (options?.prettier) {
|
|
26
|
+
presets.push(eslintPluginPrettierRecommended__default);
|
|
27
|
+
}
|
|
28
|
+
if (enableTailwindcss) {
|
|
29
|
+
presets.push(...compat.config({
|
|
30
|
+
extends: ["plugin:tailwindcss/recommended"]
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
return eslintConfig.antfu(opts, ...presets, ...userConfigs);
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
exports.icebreaker = icebreaker;
|
|
22
|
-
exports.icebreakerWithPrettier = icebreakerWithPrettier;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { sxzz } from '@sxzz/eslint-config';
|
|
2
|
-
import { FlatESLintConfigItem } from 'eslint-define-config';
|
|
3
|
-
import { Linter } from 'eslint';
|
|
4
1
|
import { OptionsConfig, TypedFlatConfigItem, Awaitable, ConfigNames } from '@antfu/eslint-config';
|
|
5
2
|
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
3
|
+
import { Linter } from 'eslint';
|
|
6
4
|
|
|
7
|
-
type
|
|
8
|
-
|
|
5
|
+
type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
|
|
6
|
+
prettier?: boolean;
|
|
7
|
+
tailwindcss?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>;
|
|
9
10
|
|
|
10
|
-
declare function icebreaker(options?:
|
|
11
|
+
declare function icebreaker(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
11
12
|
|
|
12
|
-
export {
|
|
13
|
+
export { type UserConfigItem, type UserDefinedOptions, icebreaker };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { sxzz } from '@sxzz/eslint-config';
|
|
2
|
-
import { FlatESLintConfigItem } from 'eslint-define-config';
|
|
3
|
-
import { Linter } from 'eslint';
|
|
4
1
|
import { OptionsConfig, TypedFlatConfigItem, Awaitable, ConfigNames } from '@antfu/eslint-config';
|
|
5
2
|
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
3
|
+
import { Linter } from 'eslint';
|
|
6
4
|
|
|
7
|
-
type
|
|
8
|
-
|
|
5
|
+
type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
|
|
6
|
+
prettier?: boolean;
|
|
7
|
+
tailwindcss?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>;
|
|
9
10
|
|
|
10
|
-
declare function icebreaker(options?:
|
|
11
|
+
declare function icebreaker(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
11
12
|
|
|
12
|
-
export {
|
|
13
|
+
export { type UserConfigItem, type UserDefinedOptions, icebreaker };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { sxzz } from '@sxzz/eslint-config';
|
|
2
|
-
import { FlatESLintConfigItem } from 'eslint-define-config';
|
|
3
|
-
import { Linter } from 'eslint';
|
|
4
1
|
import { OptionsConfig, TypedFlatConfigItem, Awaitable, ConfigNames } from '@antfu/eslint-config';
|
|
5
2
|
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
3
|
+
import { Linter } from 'eslint';
|
|
6
4
|
|
|
7
|
-
type
|
|
8
|
-
|
|
5
|
+
type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem & {
|
|
6
|
+
prettier?: boolean;
|
|
7
|
+
tailwindcss?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type UserConfigItem = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.FlatConfig[]>;
|
|
9
10
|
|
|
10
|
-
declare function icebreaker(options?:
|
|
11
|
+
declare function icebreaker(options?: UserDefinedOptions, ...userConfigs: UserConfigItem[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
11
12
|
|
|
12
|
-
export {
|
|
13
|
+
export { type UserConfigItem, type UserDefinedOptions, icebreaker };
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
2
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
3
|
+
import { isPackageExists } from 'local-pkg';
|
|
2
4
|
import { antfu } from '@antfu/eslint-config';
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
const compat = new FlatCompat();
|
|
7
|
+
function icebreaker(options = {}, ...userConfigs) {
|
|
8
|
+
const { prettier, tailwindcss: enableTailwindcss = isPackageExists("tailwindcss"), ...opts } = options;
|
|
9
|
+
const presets = [
|
|
10
|
+
{
|
|
11
|
+
rules: {
|
|
12
|
+
"curly": ["error", "all"],
|
|
13
|
+
"no-console": ["warn"],
|
|
14
|
+
"ts/prefer-ts-expect-error": "off",
|
|
15
|
+
"ts/ban-ts-comment": "off"
|
|
16
|
+
}
|
|
15
17
|
}
|
|
16
|
-
|
|
18
|
+
];
|
|
19
|
+
if (options?.prettier) {
|
|
20
|
+
presets.push(eslintPluginPrettierRecommended);
|
|
21
|
+
}
|
|
22
|
+
if (enableTailwindcss) {
|
|
23
|
+
presets.push(...compat.config({
|
|
24
|
+
extends: ["plugin:tailwindcss/recommended"]
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
return antfu(opts, ...presets, ...userConfigs);
|
|
17
28
|
}
|
|
18
29
|
|
|
19
|
-
export { icebreaker
|
|
30
|
+
export { icebreaker };
|
package/package.json
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icebreakers/eslint-config",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "icebreakers's eslint config",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint-config",
|
|
7
|
+
"prettier"
|
|
8
|
+
],
|
|
6
9
|
"author": "",
|
|
7
|
-
"license": "
|
|
10
|
+
"license": "MIT",
|
|
8
11
|
"type": "module",
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
14
|
"types": "./dist/index.d.ts",
|
|
12
15
|
"import": "./dist/index.mjs",
|
|
13
16
|
"require": "./dist/index.cjs"
|
|
14
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"./antfu": {
|
|
19
|
+
"types": "./dist/antfu.d.ts",
|
|
20
|
+
"import": "./dist/antfu.mjs",
|
|
21
|
+
"require": "./dist/antfu.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./*": "./*"
|
|
15
24
|
},
|
|
16
25
|
"main": "./dist/index.cjs",
|
|
17
26
|
"module": "./dist/index.mjs",
|
|
@@ -19,11 +28,25 @@
|
|
|
19
28
|
"files": [
|
|
20
29
|
"dist"
|
|
21
30
|
],
|
|
31
|
+
"typesVersions": {
|
|
32
|
+
"*": {
|
|
33
|
+
"*": [
|
|
34
|
+
"./dist/*",
|
|
35
|
+
"./dist/index.d.ts"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
22
39
|
"dependencies": {
|
|
23
|
-
"@antfu/eslint-config": "2.
|
|
24
|
-
"@
|
|
40
|
+
"@antfu/eslint-config": "2.18.0",
|
|
41
|
+
"@eslint/eslintrc": "^3.0.2",
|
|
42
|
+
"eslint-config-prettier": "^9.1.0",
|
|
43
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
44
|
+
"eslint-plugin-tailwindcss": "^3.15.1",
|
|
45
|
+
"local-pkg": "^0.5.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"eslint": "^9.2.0"
|
|
25
49
|
},
|
|
26
|
-
"devDependencies": {},
|
|
27
50
|
"scripts": {
|
|
28
51
|
"dev": "unbuild --sourcemap",
|
|
29
52
|
"build": "unbuild",
|