Skip to content

Commit 655e371

Browse files
committed
Initial commit
0 parents  commit 655e371

File tree

8 files changed

+752
-0
lines changed

8 files changed

+752
-0
lines changed

.eslintrc.json

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{
2+
"parserOptions": {
3+
"sourceType": "module",
4+
"ecmaVersion": 6,
5+
"ecmaFeatures": {
6+
"jsx": true
7+
}
8+
},
9+
10+
"env": {
11+
"node": true,
12+
"es6": true
13+
},
14+
15+
"rules": {
16+
"strict": 0,
17+
18+
"no-delete-var": 2,
19+
"no-label-var": 2,
20+
"no-shadow-restricted-names": 2,
21+
"no-shadow": 2,
22+
"no-undef-init": 2,
23+
"no-undef": 2,
24+
"no-unused-vars": [2, {
25+
"vars": "local",
26+
"args": "none"
27+
}],
28+
29+
"comma-dangle": [2, "never"],
30+
"no-console": 0,
31+
"no-constant-condition": 2,
32+
"no-debugger": 0,
33+
"no-dupe-args": 2,
34+
"no-dupe-keys": 2,
35+
"no-duplicate-case": 2,
36+
"no-empty": 2,
37+
"no-ex-assign": 2,
38+
"no-extra-boolean-cast": 2,
39+
"no-extra-parens": [2, "functions"],
40+
"no-extra-semi": 2,
41+
"no-func-assign": 2,
42+
"no-inner-declarations": 2,
43+
"no-invalid-regexp": 2,
44+
"no-irregular-whitespace": 2,
45+
"no-negated-in-lhs": 2,
46+
"no-obj-calls": 2,
47+
"no-regex-spaces": 2,
48+
"no-sparse-arrays": 2,
49+
"no-unreachable": 2,
50+
"use-isnan": 2,
51+
"no-unexpected-multiline": 2,
52+
53+
"block-scoped-var": 2,
54+
"dot-notation": 2,
55+
"dot-location": 2,
56+
"eqeqeq": [2, "allow-null"],
57+
"no-alert": 0,
58+
"no-caller": 2,
59+
"no-eval": 2,
60+
"no-extend-native": 2,
61+
"no-extra-bind": 2,
62+
"no-fallthrough": 2,
63+
"no-floating-decimal": 2,
64+
"no-implicit-coercion": [2, { "boolean": false }],
65+
"no-implied-eval": 2,
66+
"no-lone-blocks": 2,
67+
"no-loop-func": 2,
68+
"no-multi-str": 2,
69+
"no-native-reassign": 2,
70+
"no-new-func": 2,
71+
"no-new-wrappers": 2,
72+
"no-octal-escape": 2,
73+
"no-octal": 2,
74+
"no-proto": 2,
75+
"no-redeclare": 2,
76+
"no-return-assign": 2,
77+
"no-script-url": 2,
78+
"no-self-compare": 2,
79+
"no-sequences": 2,
80+
"no-throw-literal": 2,
81+
"no-useless-call": 2,
82+
"no-useless-concat": 2,
83+
"no-void": 2,
84+
"no-with": 2,
85+
"radix": 2,
86+
"wrap-iife": [2, "any"],
87+
"yoda": 2,
88+
89+
"array-bracket-spacing": 2,
90+
"block-spacing": 2,
91+
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
92+
"comma-spacing": 2,
93+
"comma-style": 2,
94+
"computed-property-spacing": 2,
95+
"consistent-this": [2, "self"],
96+
"eol-last": 2,
97+
"indent": [2, 2, { "SwitchCase": 1 }],
98+
"jsx-quotes": [2, "prefer-double"],
99+
"linebreak-style": 2,
100+
"new-parens": 2,
101+
"no-array-constructor": 2,
102+
"no-lonely-if": 2,
103+
"no-mixed-spaces-and-tabs": 2,
104+
"no-multiple-empty-lines": [2, { "max": 1, "maxEOF": 0 }],
105+
"no-nested-ternary": 2,
106+
"no-new-object": 2,
107+
"no-spaced-func": 2,
108+
"no-trailing-spaces": 2,
109+
"no-unneeded-ternary": 2,
110+
"object-curly-spacing": [2, "always"],
111+
"one-var": [2, "never"],
112+
"operator-linebreak": [2, "after", { "overrides": { "?": "after" } }],
113+
"quotes": [2, "single"],
114+
"semi-spacing": 2,
115+
"semi": 2,
116+
"keyword-spacing": [2, { "before": true, "after": true }],
117+
"space-before-blocks": 2,
118+
"space-before-function-paren": [2, { "named": "never" }],
119+
"space-in-parens": 2,
120+
"space-infix-ops": 2,
121+
"space-unary-ops": 2,
122+
"spaced-comment": 2,
123+
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
124+
"curly": 2,
125+
126+
"arrow-parens": 2,
127+
"arrow-spacing": 2,
128+
"no-const-assign": 2,
129+
"no-dupe-class-members": 2,
130+
"prefer-const": 2
131+
}
132+
}

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
lib-cov
2+
*.seed
3+
*.log
4+
*.csv
5+
*.dat
6+
*.out
7+
*.pid
8+
*.gz
9+
*.sublime-project
10+
*.sublime-workspace
11+
pids
12+
logs
13+
reports
14+
build
15+
node_modules
16+
npm-debug.log
17+
sftp-config.json

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2014 Yannick Croissant
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.

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Grouped sorting of JSX props (jsx-grouped-sort-props)
2+
3+
Specify a specific order of props or use named groups with loose ordering within each group.
4+
5+
## Rule Details
6+
7+
This rule checks all JSX components and verifies that all props are sorted correctly.
8+
9+
## Rule Options
10+
11+
```js
12+
...
13+
"jsx-grouped-sort-props/jsx-grouped-sort-props": [<enabled>, [
14+
{ group: "reserved" },
15+
"foo",
16+
"bar",
17+
{ group: "html" },
18+
{ group: "aria" },
19+
{ group: "data" },
20+
{ group: "other" },
21+
{ group: "callback" }
22+
]]
23+
...
24+
```
25+
26+
### `reserved`
27+
28+
All reserved props, as listed in the [React docs](https://facebook.github.io/react/docs/special-non-dom-attributes.html).
29+
30+
```js
31+
<Button key="1" ref="button" />
32+
```
33+
34+
### `html`
35+
36+
All props that map to supported html attributes, as listed in the [React docs](https://facebook.github.io/react/docs/tags-and-attributes.html).
37+
38+
```js
39+
<Button className="goodbye" />
40+
```
41+
42+
### `aria`
43+
44+
All aria-* attributes. If not specified, aria-* attributes will be considered part of the `html` group.
45+
46+
```js
47+
<Button aria-label="Submit" />
48+
```
49+
50+
### `data`
51+
52+
All custom data-* attributes. If not specified, data-* attributes will be considered part of the `html` group.
53+
54+
```js
55+
<Button data-id="submit" />
56+
```
57+
58+
### `callback`
59+
60+
All props that match the pattern `onCallback`.
61+
62+
```js
63+
<Button onClick={onClick} />
64+
```
65+
66+
### `other`
67+
68+
All props that do not match a different group.
69+
70+
```js
71+
<Button isLoading={true} />
72+
```
73+
74+
## When not to use
75+
76+
This rule is a formatting preference and not following it won't negatively affect the quality of your code. If prop sort order isn't a part of your coding standards, then you can leave this rule off.

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
module.exports = {
4+
rules: {
5+
'jsx-grouped-sort-props': require('./lib/jsx-grouped-sort-props')
6+
}
7+
};

0 commit comments

Comments
 (0)