소스 검색

chore: lint add space-infix-ops

pointhalo 1 년 전
부모
커밋
a7dd89e4e1
5개의 변경된 파일12개의 추가작업 그리고 14개의 파일을 삭제
  1. 2 1
      .eslintrc.js
  2. 10 10
      packages/semi-foundation/pincode/foundation.ts
  3. 0 1
      packages/semi-foundation/tsconfig.json
  4. 0 1
      packages/semi-ui/tsconfig.json
  5. 0 1
      tsconfig.json

+ 2 - 1
.eslintrc.js

@@ -43,9 +43,9 @@ module.exports = {
                 'jsx-a11y/mouse-events-have-key-events': ['warn'],
                 'object-curly-spacing': ['error', 'always'],
                 'space-before-blocks': ['error', 'always'],
+                "space-infix-ops": "error",
                 'max-len': 'off',
                 'react/forbid-foreign-prop-types': ['error', { "allowInPropTypes": true }]
-
             },
             globals: {
                 "sinon": "readonly",
@@ -118,6 +118,7 @@ module.exports = {
                 'prefer-const': 'off',
                 'semi-design/no-import': 'error',
                 'space-before-blocks': ['error', 'always'],
+                "space-infix-ops": "error",
                 "@typescript-eslint/type-annotation-spacing": ['error', {"after": true}],
                 "@typescript-eslint/member-delimiter-style": [
                     "error",

+ 10 - 10
packages/semi-foundation/pincode/foundation.ts

@@ -36,7 +36,7 @@ class PinCodeFoundation<P = Record<string, any>, S = Record<string, any>> extend
 
 
     handleCurrentActiveIndexChange = (index: number, state: "focus"|"blur")=>{
-        if (state==="focus") {
+        if (state === "focus") {
             this._adapter.onCurrentActiveIndexChange(index);
         }
     }
@@ -86,7 +86,7 @@ class PinCodeFoundation<P = Record<string, any>, S = Record<string, any>> extend
     handlePaste = async (e: ClipboardEvent, startInputIndex: number)=>{
         const textWillPaste = e.clipboardData.getData("text");
         const count = this.getProp("count");
-        for (let i = startInputIndex, charIndex=0;i<count&&charIndex<textWillPaste.length;i++, charIndex++) {
+        for (let i = startInputIndex, charIndex = 0;i < count && charIndex < textWillPaste.length;i++, charIndex++) {
             const currentChar = textWillPaste[charIndex];
             if (this.validateValue(currentChar)) {
                 await this.completeSingleInput(i, currentChar);
@@ -99,21 +99,21 @@ class PinCodeFoundation<P = Record<string, any>, S = Record<string, any>> extend
 
     handleKeyDownOnSingleInput = (e: KeyboardEvent, index: number)=>{
         const valueList = [...this.getState("valueList")];
-        if (e.key==="Backspace") {
+        if (e.key === "Backspace") {
             valueList[index] = "";
             this.updateValueList(valueList);
-            this._adapter.changeSpecificInputFocusState(Math.max(0, index-1), "focus");
+            this._adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
             e.preventDefault();
-        } else if (e.key==="Delete") {
+        } else if (e.key === "Delete") {
             valueList[index] = "";
             this.updateValueList(valueList);
-            this._adapter.changeSpecificInputFocusState(Math.min(valueList.length-1, index+1), "focus");
+            this._adapter.changeSpecificInputFocusState(Math.min(valueList.length - 1, index + 1), "focus");
             e.preventDefault();
-        } else if (e.key==="ArrowLeft") {
-            this._adapter.changeSpecificInputFocusState(Math.max(0, index-1), "focus");
+        } else if (e.key === "ArrowLeft") {
+            this._adapter.changeSpecificInputFocusState(Math.max(0, index - 1), "focus");
             e.preventDefault();
-        } else if (e.key==="ArrowRight") {
-            this._adapter.changeSpecificInputFocusState(Math.min(valueList.length-1, index+1), "focus");
+        } else if (e.key === "ArrowRight") {
+            this._adapter.changeSpecificInputFocusState(Math.min(valueList.length - 1, index + 1), "focus");
             e.preventDefault();
         }
 

+ 0 - 1
packages/semi-foundation/tsconfig.json

@@ -9,7 +9,6 @@
         "lib": ["es7", "dom", "es2017"],
         "moduleResolution": "node",
         "noImplicitAny": false,
-        "suppressImplicitAnyIndexErrors": true,
         "forceConsistentCasingInFileNames": true,
         "allowSyntheticDefaultImports": true,
         "experimentalDecorators": true,

+ 0 - 1
packages/semi-ui/tsconfig.json

@@ -16,7 +16,6 @@
             "@douyinfe/semi-theme-default/*": ["../semi-theme-default/*"],
             "@douyinfe/semi-icons": ["../semi-icons/src"]
         },
-        "suppressImplicitAnyIndexErrors": true,
         "forceConsistentCasingInFileNames": true,
         "allowSyntheticDefaultImports": true,
         "experimentalDecorators": true,

+ 0 - 1
tsconfig.json

@@ -17,7 +17,6 @@
             "@douyinfe/semi-icons": ["./packages/semi-icons/src/index"],
             "@douyinfe/semi-illustrations": ["./packages/semi-illustrations/src/index"],
         },
-        "suppressImplicitAnyIndexErrors": true,
         "forceConsistentCasingInFileNames": true,
         "importHelpers": true,
         "allowSyntheticDefaultImports": true,