@angelblanco/eslint-config 0.0.1
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/LICENSE +21 -0
- package/README.md +130 -0
- package/dist/index.cjs +67 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +36 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ángel Blanco
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# @angelblanco/eslint-config
|
|
2
|
+
|
|
3
|
+
Ángel Blanco's ESLint Config - based on [@antfu/eslint-config](https://github.com/antfu/eslint-config)
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- TypeScript support enabled by default
|
|
8
|
+
- Vue support enabled by default
|
|
9
|
+
- Formatters enabled
|
|
10
|
+
- Stylistic rules with semicolons and 2-space indentation
|
|
11
|
+
- Custom Vue block order: template → script → style
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add -D eslint @angelblanco/eslint-config
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Basic Setup
|
|
22
|
+
|
|
23
|
+
Create `eslint.config.js` in your project root:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import eslintConfig from '@angelblanco/eslint-config'
|
|
27
|
+
|
|
28
|
+
export default eslintConfig()
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Custom Options
|
|
32
|
+
|
|
33
|
+
You can customize the default options by passing a function:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
import eslintConfig from '@angelblanco/eslint-config'
|
|
37
|
+
|
|
38
|
+
export default eslintConfig((defaultOptions) => {
|
|
39
|
+
return {
|
|
40
|
+
...defaultOptions,
|
|
41
|
+
stylistic: {
|
|
42
|
+
...defaultOptions.stylistic,
|
|
43
|
+
semi: false, // Disable semicolons
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Custom Rules
|
|
50
|
+
|
|
51
|
+
Add your own ESLint configs as a second parameter:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
import eslintConfig from '@angelblanco/eslint-config'
|
|
55
|
+
|
|
56
|
+
export default eslintConfig(
|
|
57
|
+
null, // Use default options
|
|
58
|
+
(defaultConfigs) => [
|
|
59
|
+
...defaultConfigs,
|
|
60
|
+
{
|
|
61
|
+
rules: {
|
|
62
|
+
'no-console': 'warn',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Creating Your Own Config
|
|
70
|
+
|
|
71
|
+
This repository can be used as a template for creating your own shareable ESLint config. Here's how to fork and customize it:
|
|
72
|
+
|
|
73
|
+
### 1. Fork the Repository
|
|
74
|
+
|
|
75
|
+
Click the "Fork" button on GitHub or clone this repository to start with your own copy.
|
|
76
|
+
|
|
77
|
+
### 2. Customize Package Details
|
|
78
|
+
|
|
79
|
+
Update `package.json` with your information:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"name": "@yourname/eslint-config",
|
|
84
|
+
"author": "Your Name",
|
|
85
|
+
"repository": "yourname/eslint-config",
|
|
86
|
+
// ... other fields
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. Modify the Configuration
|
|
91
|
+
|
|
92
|
+
Edit `src/index.ts` to adjust:
|
|
93
|
+
- Default options (TypeScript, Vue, formatters, etc.)
|
|
94
|
+
- Stylistic preferences (semicolons, indentation, quotes)
|
|
95
|
+
- Custom rules and overrides
|
|
96
|
+
- Vue block ordering or other framework-specific settings
|
|
97
|
+
|
|
98
|
+
### 4. Update Documentation
|
|
99
|
+
|
|
100
|
+
- Modify this `README.md` to reflect your config's features
|
|
101
|
+
- Update installation instructions with your package name
|
|
102
|
+
- Document any custom rules or conventions
|
|
103
|
+
|
|
104
|
+
### 5. Publish Your Config
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Build the package
|
|
108
|
+
pnpm build
|
|
109
|
+
|
|
110
|
+
# Publish to npm (requires npm account)
|
|
111
|
+
npm publish --access public
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 6. Use Your Config
|
|
115
|
+
|
|
116
|
+
Install and use your custom config in projects:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
pnpm add -D eslint @yourname/eslint-config
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
import eslintConfig from '@yourname/eslint-config'
|
|
124
|
+
|
|
125
|
+
export default eslintConfig()
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
[MIT](LICENSE)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
default: () => eslintConfig
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_eslint_config = __toESM(require("@antfu/eslint-config"), 1);
|
|
37
|
+
function getDefaultOptions() {
|
|
38
|
+
return {
|
|
39
|
+
typescript: true,
|
|
40
|
+
vue: true,
|
|
41
|
+
formatters: true,
|
|
42
|
+
stylistic: {
|
|
43
|
+
semi: true,
|
|
44
|
+
indent: 2
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function getDefaultUserConfigs() {
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
files: ["**/*.vue"],
|
|
52
|
+
rules: {
|
|
53
|
+
"vue/block-order": ["error", {
|
|
54
|
+
order: ["template", "script", "style"]
|
|
55
|
+
}]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
function eslintConfig(applyUserOptions = null, applyUserConfigs = null) {
|
|
61
|
+
const options = applyUserOptions ? applyUserOptions(getDefaultOptions()) : getDefaultOptions();
|
|
62
|
+
const userConfig = applyUserConfigs ? applyUserConfigs(getDefaultUserConfigs()) : getDefaultUserConfigs();
|
|
63
|
+
return (0, import_eslint_config.default)(
|
|
64
|
+
options,
|
|
65
|
+
...userConfig
|
|
66
|
+
);
|
|
67
|
+
}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import antfu from '@antfu/eslint-config';
|
|
2
|
+
|
|
3
|
+
type AntfuOptions = Parameters<typeof antfu>[0];
|
|
4
|
+
type UserConfigs = Parameters<typeof antfu>[1];
|
|
5
|
+
type EslintConfig = ReturnType<typeof antfu>;
|
|
6
|
+
/**
|
|
7
|
+
* A function that returns user options to be merged with the default ones (or overwritten).
|
|
8
|
+
*/
|
|
9
|
+
type ApplyUserOptionsFunction = (defualtOptions: AntfuOptions) => AntfuOptions;
|
|
10
|
+
/**
|
|
11
|
+
* A function that returns an array of user configs to be merged with the default ones (or overwritten).
|
|
12
|
+
*/
|
|
13
|
+
type ApplyUserConfigsFunction = (defaultUserConfigs: UserConfigs[]) => UserConfigs[];
|
|
14
|
+
declare function eslintConfig(applyUserOptions?: ApplyUserOptionsFunction | null, applyUserConfigs?: ApplyUserConfigsFunction | null): EslintConfig;
|
|
15
|
+
|
|
16
|
+
export { eslintConfig as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import antfu from '@antfu/eslint-config';
|
|
2
|
+
|
|
3
|
+
type AntfuOptions = Parameters<typeof antfu>[0];
|
|
4
|
+
type UserConfigs = Parameters<typeof antfu>[1];
|
|
5
|
+
type EslintConfig = ReturnType<typeof antfu>;
|
|
6
|
+
/**
|
|
7
|
+
* A function that returns user options to be merged with the default ones (or overwritten).
|
|
8
|
+
*/
|
|
9
|
+
type ApplyUserOptionsFunction = (defualtOptions: AntfuOptions) => AntfuOptions;
|
|
10
|
+
/**
|
|
11
|
+
* A function that returns an array of user configs to be merged with the default ones (or overwritten).
|
|
12
|
+
*/
|
|
13
|
+
type ApplyUserConfigsFunction = (defaultUserConfigs: UserConfigs[]) => UserConfigs[];
|
|
14
|
+
declare function eslintConfig(applyUserOptions?: ApplyUserOptionsFunction | null, applyUserConfigs?: ApplyUserConfigsFunction | null): EslintConfig;
|
|
15
|
+
|
|
16
|
+
export { eslintConfig as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import antfu from "@antfu/eslint-config";
|
|
3
|
+
function getDefaultOptions() {
|
|
4
|
+
return {
|
|
5
|
+
typescript: true,
|
|
6
|
+
vue: true,
|
|
7
|
+
formatters: true,
|
|
8
|
+
stylistic: {
|
|
9
|
+
semi: true,
|
|
10
|
+
indent: 2
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function getDefaultUserConfigs() {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
files: ["**/*.vue"],
|
|
18
|
+
rules: {
|
|
19
|
+
"vue/block-order": ["error", {
|
|
20
|
+
order: ["template", "script", "style"]
|
|
21
|
+
}]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
function eslintConfig(applyUserOptions = null, applyUserConfigs = null) {
|
|
27
|
+
const options = applyUserOptions ? applyUserOptions(getDefaultOptions()) : getDefaultOptions();
|
|
28
|
+
const userConfig = applyUserConfigs ? applyUserConfigs(getDefaultUserConfigs()) : getDefaultUserConfigs();
|
|
29
|
+
return antfu(
|
|
30
|
+
options,
|
|
31
|
+
...userConfig
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
eslintConfig as default
|
|
36
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@angelblanco/eslint-config",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"packageManager": "pnpm@10.20.0+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd",
|
|
6
|
+
"description": "Ángel Blanco's Eslint Config - based on @antfu/eslint-config",
|
|
7
|
+
"author": "Ángel Blanco",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"homepage": "https://github.com/angelblanco/eslint-config#readme",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/angelblanco/eslint-config.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/angelblanco/eslint-config/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"eslint",
|
|
19
|
+
"eslint-config"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"require": "./dist/index.cjs"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"main": "./dist/index.cjs",
|
|
29
|
+
"module": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"lint:fix": "eslint . --fix",
|
|
37
|
+
"test": "tsc --noEmit",
|
|
38
|
+
"build": "tsup index.ts --format cjs,esm --dts"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@antfu/eslint-config": "^6.2.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"eslint": "^9.38.0",
|
|
45
|
+
"eslint-plugin-format": "^1.0.2",
|
|
46
|
+
"jiti": "^2.6.1",
|
|
47
|
+
"tsup": "^8.5.0",
|
|
48
|
+
"typescript": "^5.9.3"
|
|
49
|
+
}
|
|
50
|
+
}
|