Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commitf41b991

Browse files
committed
Add eslint configure and tweak code
1 parente271723 commitf41b991

22 files changed

+236
-63
lines changed

‎.eslintignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
coverage

‎.eslintrc‎

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
{
2+
"ecmaFeatures": {
3+
"modules": true
4+
},
5+
"env": {
6+
"node": true,
7+
"es6": true,
8+
"mocha": true
9+
},
10+
"rules": {
11+
// Possible Errors
12+
"comma-dangle": [ 2, "never" ],
13+
"no-cond-assign": 0,
14+
"no-console": 1,
15+
"no-constant-condition": 1,
16+
"no-control-regex": 0,
17+
"no-debugger": 1,
18+
"no-dupe-args": 2,
19+
"no-dupe-keys": 2,
20+
"no-duplicate-case": 2,
21+
"no-empty": 1,
22+
"no-ex-assign": 1,
23+
"no-extra-boolean-cast": 1,
24+
"no-extra-parens": 0,
25+
"no-extra-semi": 1,
26+
"no-func-assign": 1,
27+
"no-inner-declarations": 1,
28+
"no-invalid-regexp": 2,
29+
"no-irregular-whitespace": 2,
30+
"no-negated-in-lhs": 2,
31+
"no-obj-calls": 1,
32+
"no-regex-spaces": 1,
33+
"no-sparse-arrays": 2,
34+
"no-unreachable": 2,
35+
"use-isnan": 2,
36+
"valid-jsdoc": 0,
37+
"valid-typeof": 2,
38+
39+
// Best Practices
40+
"accessor-pairs": 0,
41+
"block-scoped-var": 1,
42+
"complexity": 0,
43+
"consitent-return": 0,
44+
"curly": 1,
45+
"default-case": 0,
46+
"dot-notation": [ 1, { "allowKeywords": false } ],
47+
"dot-location": [ 1, "property" ],
48+
"eqeqeq": [ 2, "smart" ],
49+
"guard-for-in": 0,
50+
"no-alert": 2,
51+
"no-caller": 2,
52+
"no-div-regex": 1,
53+
"no-else-return": 0,
54+
"no-eq-null": 1,
55+
"no-eval": 0,
56+
"no-extend-native": 2,
57+
"no-extra-bind": 2,
58+
"no-fallthrough": 1,
59+
"no-floating-decimal": 1,
60+
"no-implied-eval": 2,
61+
"no-iterator": 2,
62+
"no-labels": [ 1, { allowLoop: true } ],
63+
"no-lone-blocks": 2,
64+
"no-loop-func": 0,
65+
"no-multi-spaces": 2,
66+
"no-multi-str": 1,
67+
"no-native-reassign": 2,
68+
"no-new-func": 0,
69+
"no-new-wrappers": 1,
70+
"no-new": 1,
71+
"no-octal-escape": 1,
72+
"no-octal": 0,
73+
"no-param-reassign": 0,
74+
"no-process-env": 2,
75+
"no-proto": 2,
76+
"no-redeclare": 2,
77+
"no-return-assign": 1,
78+
"no-script-url": 2,
79+
"no-self-compare": 2,
80+
"no-sequences": 0,
81+
"no-throw-literal": 1,
82+
"no-unused-expressions": 1,
83+
"no-void": 2,
84+
"no-warning-comments": 0,
85+
"no-with": 2,
86+
"radix": 0,
87+
"vars-on-top": 0,
88+
"wrap-iife": 1,
89+
"yoda": [ 1, "never", { "exceptRange": true } ],
90+
91+
// Variables
92+
"no-catch-shadow": 1,
93+
"no-delete-var": 2,
94+
"no-label-var": 2,
95+
"no-shadow-restricted-names": 1,
96+
"no-shadow": 0,
97+
"no-undef-init": 1,
98+
"no-undef": 2,
99+
"no-undefined": 0,
100+
"no-unused-vars": 1,
101+
"no-use-before-define": 0,
102+
103+
// Code style
104+
"brace-style": [ 2, "1tbs", { "allowSingleLine": true } ],
105+
"camelcase": [ 1, { "properties": "never" } ],
106+
"comma-spacing": [ 2, { "before": false, "after": true } ],
107+
"comma-style": [ 2, "last" ],
108+
"consistent-this": 0,
109+
"eol-last": 1,
110+
"func-names": 0,
111+
"func-style": 0,
112+
"indent": [ 1, 4 ],
113+
"key-spacing": [ 1, { "beforeColon": false, "afterColon": true } ],
114+
"lines-around-comment": 0,
115+
"max-nested-callbacks": [1, 4],
116+
"new-cap": 0,
117+
"new-parens": 1,
118+
"newline-after-var": 0,
119+
"no-array-constructor": 1,
120+
"no-continue": 0,
121+
"no-inline-comments": 0,
122+
"no-lonely-if": 1,
123+
"no-mixed-spaces-and-tabs": 2,
124+
"no-multiple-empty-lines": 1,
125+
"no-nested-ternary": 1,
126+
"no-new-object": 1,
127+
"no-spaced-func": 1,
128+
"no-ternary": 0,
129+
"no-trailing-spaces": [ 1, { "skipBlankLines": true } ],
130+
"no-underscore-dangle": 0,
131+
"no-unneeded-ternary": 1,
132+
"object-curly-spacing": [ 1, "always" ],
133+
"one-var": 0,
134+
"operator-assignment": 0,
135+
"operator-linebreak": [ 1, "after" ],
136+
"padded-blocks": 0,
137+
"quote-props": 0,
138+
"quotes": [ 1, "single" ],
139+
"semi-spacing": 0,
140+
"semi": [ 1, "never" ],
141+
"sort-vars": 0,
142+
"keyword-spacing": 1,
143+
"space-before-blocks": [ 1, "always" ],
144+
"space-before-function-paren": [ 1, { "anonymous": "always", "named": "never" } ],
145+
"space-in-parens": [ 1, "never" ],
146+
"space-infix-ops": [ 1, { "int32Hint": false } ],
147+
"space-unary-ops": [ 1, { "words": true, "nonwords": false } ],
148+
"spaced-comment": 0,
149+
"wrap-regex": 0,
150+
151+
// EMCAScript 6
152+
"generator-star-spacing": [ 1, "before" ],
153+
"no-var": 1,
154+
"object-shorthand": [ 1, "always" ],
155+
"prefer-const": 1,
156+
157+
// Legacy
158+
"max-depth": [ 1, 5 ],
159+
"max-len": 0,
160+
"max-params": [ 1, 5 ],
161+
"max-statements": 0,
162+
"no-bitwise": 0,
163+
"no-plusplus": 0
164+
}
165+
}

‎.travis.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ cache:
55
-node_modules
66
install:
77
-npm install
8+
-npm install -g eslint
89
-npm install -g codecov
910
script:
11+
-eslint .
1012
-istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec
1113
-codecov
1214

‎lib/Builder.js‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const NON_LITERAL_CHARACTERS = '[\\^$.|?*+()/'
88
constMETHOD_TYPE_BEGIN=0b00001
99
constMETHOD_TYPE_CHARACTER=0b00010
1010
constMETHOD_TYPE_GROUP=0b00100
11-
constMETHOD_TYPE_QUANTIFIER=0b01000;
12-
constMETHOD_TYPE_ANCHOR=0b10000;
13-
constMETHOD_TYPE_UNKNOWN=0b11111;
11+
constMETHOD_TYPE_QUANTIFIER=0b01000
12+
constMETHOD_TYPE_ANCHOR=0b10000
13+
constMETHOD_TYPE_UNKNOWN=0b11111
1414
constMETHOD_TYPES_ALLOWED_FOR_CHARACTERS=METHOD_TYPE_BEGIN|METHOD_TYPE_ANCHOR|METHOD_TYPE_GROUP|METHOD_TYPE_QUANTIFIER|METHOD_TYPE_CHARACTER
1515

1616
constsimpleMapper={
@@ -145,7 +145,7 @@ class Builder {
145145
*/
146146
literally(chars){
147147
this._validateAndAddMethodType(METHOD_TYPE_CHARACTER,METHOD_TYPES_ALLOWED_FOR_CHARACTERS)
148-
letresult=chars.split('').map((character)=>this.escape(character)).join('')
148+
constresult=chars.split('').map((character)=>this.escape(character)).join('')
149149

150150
returnthis.add(`(?:${result})`)
151151
}
@@ -369,10 +369,7 @@ class Builder {
369369
*@return {Builder}
370370
*/
371371
until(toCondition){
372-
try{
373-
this.lazy()
374-
}catch(e){}
375-
372+
this.lazy()
376373
this._validateAndAddMethodType(METHOD_TYPE_GROUP,METHOD_TYPES_ALLOWED_FOR_CHARACTERS)
377374

378375
returnthis._addClosure(newBuilder(),toCondition)
@@ -475,7 +472,7 @@ class Builder {
475472
*@return {string}
476473
*/
477474
getModifiers(){
478-
returnthis._modifiers;
475+
returnthis._modifiers
479476
}
480477

481478
/**
@@ -512,7 +509,7 @@ class Builder {
512509
}[this._lastMethodType]
513510

514511
thrownewImplementationException(
515-
`Method${methodName} is not allowed${messgae||'here'}`
512+
`Method${methodName} is not allowed${message||'here'}`
516513
)
517514
}
518515

@@ -558,7 +555,7 @@ class Builder {
558555
_addClosure(builder,conditions){
559556
if(typeofconditions==='string'){
560557
builder.literally(conditions)
561-
}elseif(conditionsinstanceofBuilder){
558+
}elseif(conditionsinstanceofBuilder){
562559
builder.raw(conditions.getRawRegex())
563560
}else{
564561
conditions(builder)

‎lib/Builder/Capture.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class Capture extends Builder {
1111
}
1212
}
1313

14-
module.exports=Capture
14+
module.exports=Capture

‎lib/Builder/EitherOf.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ class EitherOf extends Builder {
1414
}
1515
}
1616

17-
module.exports=EitherOf
17+
module.exports=EitherOf

‎lib/Builder/NegativeLookahead.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class NegativeLookahead extends Builder {
1111
}
1212
}
1313

14-
module.exports=NegativeLookahead
14+
module.exports=NegativeLookahead

‎lib/Builder/NonCapture.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class NonCapture extends Builder {
1111
}
1212
}
1313

14-
module.exports=NonCapture
14+
module.exports=NonCapture

‎lib/Builder/Optional.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class Optional extends Builder {
1111
}
1212
}
1313

14-
module.exports=Optional
14+
module.exports=Optional

‎lib/Builder/PositiveLookahead.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class PositiveLookahead extends Builder {
1111
}
1212
}
1313

14-
module.exports=PositiveLookahead
14+
module.exports=PositiveLookahead

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp