Skip to content

Commit 5d57134

Browse files
committed
publish v0.4.0
1 parent 57c2d19 commit 5d57134

File tree

2 files changed

+50
-28
lines changed

2 files changed

+50
-28
lines changed

lib/eslint.js

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,50 @@
11
"use strict";
2-
module.exports = {
3-
env: {
4-
node: true,
5-
browser: true,
6-
es6: true,
7-
},
8-
parser: '@typescript-eslint/parser',
9-
extends: [
2+
var __assign = (this && this.__assign) || function () {
3+
__assign = Object.assign || function(t) {
4+
for (var s, i = 1, n = arguments.length; i < n; i++) {
5+
s = arguments[i];
6+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7+
t[p] = s[p];
8+
}
9+
return t;
10+
};
11+
return __assign.apply(this, arguments);
12+
};
13+
var __importDefault = (this && this.__importDefault) || function (mod) {
14+
return (mod && mod.__esModule) ? mod : { "default": mod };
15+
};
16+
Object.defineProperty(exports, "__esModule", { value: true });
17+
var fs_1 = __importDefault(require("fs"));
18+
var path_1 = __importDefault(require("path"));
19+
var IS_TS_PROJECT = fs_1.default.existsSync(path_1.default.join(process.cwd() || '.', './tsconfig.json'));
20+
var parser = IS_TS_PROJECT
21+
? '@typescript-eslint/parser'
22+
: '@babel/eslint-parser';
23+
var _extends = (function () {
24+
return [
1025
'eslint:recommended',
26+
IS_TS_PROJECT ? 'plugin:@typescript-eslint/recommended' : null,
1127
'plugin:import/errors',
1228
'plugin:import/warnings',
1329
'plugin:import/typescript',
14-
'plugin:@typescript-eslint/recommended',
1530
'plugin:jsx-a11y/recommended',
1631
'plugin:react/recommended',
1732
'plugin:react-hooks/recommended',
1833
'plugin:prettier/recommended',
19-
],
20-
plugins: ['simple-import-sort'],
21-
rules: {
22-
'simple-import-sort/imports': 1,
23-
'simple-import-sort/exports': 1,
24-
'sort-imports': 0,
25-
'import/order': 0,
34+
].filter(function (el) { return el && typeof el === 'string'; });
35+
})();
36+
var rules = __assign({ 'simple-import-sort/imports': 1, 'simple-import-sort/exports': 1, 'sort-imports': 0, 'import/order': 0, 'react/jsx-sort-props': [
37+
2,
38+
{
39+
callbacksLast: true,
40+
shorthandFirst: true,
41+
shorthandLast: false,
42+
ignoreCase: false,
43+
noSortAlphabetically: false,
44+
reservedFirst: true,
45+
},
46+
] }, (IS_TS_PROJECT
47+
? {
2648
'@typescript-eslint/no-var-requires': 0,
2749
'@typescript-eslint/no-non-null-assertion': 0,
2850
'@typescript-eslint/no-use-before-define': 2,
@@ -34,16 +56,16 @@ module.exports = {
3456
disallowTypeAnnotations: true,
3557
},
3658
],
37-
'react/jsx-sort-props': [
38-
2,
39-
{
40-
callbacksLast: true,
41-
shorthandFirst: true,
42-
shorthandLast: false,
43-
ignoreCase: false,
44-
noSortAlphabetically: false,
45-
reservedFirst: true,
46-
},
47-
],
59+
}
60+
: {}));
61+
module.exports = {
62+
env: {
63+
node: true,
64+
browser: true,
65+
es6: true,
4866
},
67+
parser: parser,
68+
extends: _extends,
69+
plugins: ['simple-import-sort'],
70+
rules: rules,
4971
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "prefer-code-style",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"description": "A common code style rules.",
55
"author": "LeoKu <[email protected]>",
66
"license": "MIT",

0 commit comments

Comments
 (0)