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

Commit3d62d57

Browse files
authored
Build: Correct code indentations based on jQuery Style Guide
1. Correct code indentations based on jQuery Style Guide (contribute.jquery.org/style-guide/js/#spacing).2. Add rules to "src/.eslintrc.json" to enable "enforcing consistent indentation", with minimal changes to the current code.Closesgh-4672
1 parent11066a9 commit3d62d57

File tree

16 files changed

+60
-42
lines changed

16 files changed

+60
-42
lines changed

‎src/.eslintrc.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
"rules": {
1414
"import/extensions": ["error","always" ],
15-
"import/no-cycle":"error"
15+
"import/no-cycle":"error",
16+
"indent": ["error","tab", {
17+
"outerIIFEBody":0
18+
} ]
1619
},
1720

1821
"overrides": [
@@ -23,7 +26,17 @@
2326
"sourceType":"script"
2427
},
2528
"rules": {
26-
"no-unused-vars":"off"
29+
"no-unused-vars":"off",
30+
"indent": ["error","tab", {
31+
32+
// Unlike other codes, "wrapper.js" is implemented in UMD.
33+
// So it required a specific exception for jQuery's UMD
34+
// Code Style. This makes that indentation check is not
35+
// performed for 1 depth of outer FunctionExpressions
36+
"ignoredNodes": [
37+
"Program > ExpressionStatement > CallExpression > FunctionExpression > *"
38+
]
39+
} ]
2740
},
2841
"globals": {
2942
"jQuery":false,

‎src/ajax.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ var
4545

4646
// Anchor tag for parsing the document origin
4747
originAnchor=document.createElement("a");
48-
originAnchor.href=location.href;
48+
49+
originAnchor.href=location.href;
4950

5051
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
5152
functionaddToPrefiltersOrTransports(structure){
@@ -426,8 +427,8 @@ jQuery.extend( {
426427
// Context for global events is callbackContext if it is a DOM node or jQuery collection
427428
globalEventContext=s.context&&
428429
(callbackContext.nodeType||callbackContext.jquery) ?
429-
jQuery(callbackContext) :
430-
jQuery.event,
430+
jQuery(callbackContext) :
431+
jQuery.event,
431432

432433
// Deferreds
433434
deferred=jQuery.Deferred(),

‎src/ajax/xhr.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jQuery.ajaxSettings.xhr = function() {
88

99
varxhrSuccessStatus={
1010

11-
// File protocol always yields status code 0, assume 200
12-
0:200
13-
};
11+
// File protocol always yields status code 0, assume 200
12+
0:200
13+
};
1414

1515
jQuery.ajaxTransport(function(options){
1616
varcallback;

‎src/attributes/classes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ jQuery.fn.extend( {
155155
if(this.setAttribute){
156156
this.setAttribute("class",
157157
className||value===false ?
158-
"" :
159-
dataPriv.get(this,"__className__")||""
158+
"" :
159+
dataPriv.get(this,"__className__")||""
160160
);
161161
}
162162
}
@@ -171,7 +171,7 @@ jQuery.fn.extend( {
171171
while((elem=this[i++])){
172172
if(elem.nodeType===1&&
173173
(" "+stripAndCollapse(getClass(elem))+" ").indexOf(className)>-1){
174-
returntrue;
174+
returntrue;
175175
}
176176
}
177177

‎src/core.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ jQuery.extend( {
303303
if(isArrayLike(Object(arr))){
304304
jQuery.merge(ret,
305305
typeofarr==="string" ?
306-
[arr] :arr
306+
[arr] :arr
307307
);
308308
}else{
309309
push.call(ret,arr);
@@ -405,9 +405,9 @@ if ( typeof Symbol === "function" ) {
405405

406406
// Populate the class2type map
407407
jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),
408-
function(_i,name){
409-
class2type["[object "+name+"]"]=name.toLowerCase();
410-
});
408+
function(_i,name){
409+
class2type["[object "+name+"]"]=name.toLowerCase();
410+
});
411411

412412
functionisArrayLike(obj){
413413

‎src/core/access.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
4343
for(;i<len;i++){
4444
fn(
4545
elems[i],key,raw ?
46-
value :
47-
value.call(elems[i],i,fn(elems[i],key))
46+
value :
47+
value.call(elems[i],i,fn(elems[i],key))
4848
);
4949
}
5050
}

‎src/core/nodeName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
functionnodeName(elem,name){
22

3-
returnelem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase();
3+
returnelem.nodeName&&elem.nodeName.toLowerCase()===name.toLowerCase();
44

55
};
66

‎src/css.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,10 @@ jQuery.each( [ "height", "width" ], function( _i, dimension ) {
320320
// Running getBoundingClientRect on a disconnected node
321321
// in IE throws an error.
322322
(!elem.getClientRects().length||!elem.getBoundingClientRect().width) ?
323-
swap(elem,cssShow,function(){
324-
returngetWidthOrHeight(elem,dimension,extra);
325-
}) :
326-
getWidthOrHeight(elem,dimension,extra);
323+
swap(elem,cssShow,function(){
324+
returngetWidthOrHeight(elem,dimension,extra);
325+
}) :
326+
getWidthOrHeight(elem,dimension,extra);
327327
}
328328
},
329329

‎src/deprecated/event.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ jQuery.fn.extend( {
2828
}
2929
});
3030

31-
jQuery.each(("blur focus focusin focusout resize scroll click dblclick "+
31+
jQuery.each(
32+
("blur focus focusin focusout resize scroll click dblclick "+
3233
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave "+
3334
"change select submit keydown keypress keyup contextmenu").split(" "),
3435
function(_i,name){
@@ -39,4 +40,5 @@ jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
3940
this.on(name,null,data,fn) :
4041
this.trigger(name);
4142
};
42-
});
43+
}
44+
);

‎src/dimensions.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ import "./css.js";
66

77
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
88
jQuery.each({Height:"height",Width:"width"},function(name,type){
9-
jQuery.each({padding:"inner"+name,content:type,"":"outer"+name},
10-
function(defaultExtra,funcName){
9+
jQuery.each({
10+
padding:"inner"+name,
11+
content:type,
12+
"":"outer"+name
13+
},function(defaultExtra,funcName){
1114

1215
// Margin is only for outerHeight, outerWidth
1316
jQuery.fn[funcName]=function(margin,value){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp