Skip to content

Commit a76d631

Browse files
committed
first release
1 parent 8deed40 commit a76d631

File tree

3 files changed

+95
-9
lines changed

3 files changed

+95
-9
lines changed

README.md

+78-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,78 @@
1-
# eslint-plugin-vue-sort-components
2-
A plugin for ESLint to keep order of component names
1+
# `eslint-plugin-vue-sort-components`
2+
3+
A plugin for ESLint to keep order of component names.
4+
5+
## Installation
6+
7+
```shell
8+
$ npm install --save-dev eslint @jay-es/eslint-plugin-vue-sort-components
9+
```
10+
11+
or
12+
13+
```shell
14+
$ yarn add -dev @jay-es/eslint-plugin-vue-sort-components
15+
```
16+
17+
## Usage
18+
19+
Add `plugin:@jay-es/vue-sort-components/recommended` to the extends section of your `.eslintrc` configuration file.
20+
21+
```js
22+
{
23+
"extends": [
24+
// ...
25+
"plugin:@jay-es/vue-sort-components/recommended"
26+
]
27+
}
28+
```
29+
30+
### Custom Configuration
31+
32+
Add `@jay-es/vue-sort-components` to the plugins section of your `.eslintrc` configuration file.
33+
34+
```js
35+
{
36+
"plugins": ["@jay-es/vue-sort-components"]
37+
}
38+
```
39+
40+
Then configure the rule under the rules section.
41+
42+
```js
43+
{
44+
"rules": {
45+
"@jay-es/vue-sort-components/vue-sort-components": "error"
46+
}
47+
}
48+
```
49+
50+
## Rule Details
51+
52+
This rule checks property definitions of object expressions named `components` and verifies that all keys are sorted alphabetically.
53+
54+
Examples of **incorrect** code for this rule:
55+
56+
```js
57+
export default defineComponent({
58+
components: { Foo, Bar, Baz },
59+
});
60+
61+
// not only in Vue-specific context
62+
const myObject = {
63+
components: { Foo, Bar, Baz },
64+
};
65+
```
66+
67+
Examples of **correct** code for this rule:
68+
69+
```js
70+
export default defineComponent({
71+
components: { Bar, Baz, Foo },
72+
});
73+
74+
// not only in Vue-specific context
75+
const myObject = {
76+
components: { Bar, Baz, Foo },
77+
};
78+
```

lib/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ module.exports = {
1111
},
1212
configs: {
1313
recommended: {
14-
plugins: ["vue-sort-components"],
14+
plugins: ["@jay-es/vue-sort-components"],
1515
rules: {
16-
"vue-sort-components/vue-sort-components": "error",
16+
"@jay-es/vue-sort-components/vue-sort-components": "error",
1717
},
1818
},
1919
},

package.json

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
2-
"name": "eslint-plugin-vue-sort-components",
3-
"version": "1.0.0",
2+
"name": "@jay-es/eslint-plugin-vue-sort-components",
3+
"version": "0.1.0",
44
"description": "A plugin for ESLint to keep order of component names",
55
"main": "lib/index.js",
6+
"files": [
7+
"README.md",
8+
"lib"
9+
],
610
"scripts": {
711
"prepare": "husky install",
812
"format": "prettier --check ./**/*.js",
@@ -14,9 +18,15 @@
1418
"type": "git",
1519
"url": "git+https://github.com/jay-es/eslint-plugin-vue-sort-components.git"
1620
},
17-
"keywords": [],
18-
"author": "",
19-
"license": "ISC",
21+
"keywords": [
22+
"eslint",
23+
"vue",
24+
"sort",
25+
"components",
26+
"order"
27+
],
28+
"author": "jay-es",
29+
"license": "MIT",
2030
"bugs": {
2131
"url": "https://github.com/jay-es/eslint-plugin-vue-sort-components/issues"
2232
},

0 commit comments

Comments
 (0)