代码之家  ›  专栏  ›  技术社区  ›  nop

我不希望WebStorm删除“import{Injectable}…”之间的空格

  •  -3
  • nop  · 技术社区  · 4 年前

    当我按下 Ctrl + Alt + L import { Injectable } import {Injectable} . 我不喜欢那样。我该怎么修?

    import { Injectable } from '@angular/core';
    import { TranslateService, LangChangeEvent } from '@ngx-translate/core';
    import { Subscription } from 'rxjs';
    
    import { Logger } from '../core';
    import enUS from '../../translations/en-US.json';
    import bgBG from '../../translations/bg-BG.json';
    
    const log = new Logger('I18nService');
    const languageKey = 'language';
    
    @Injectable({
      providedIn: 'root'
    })
    export class I18nService {
    

    {
      "extends": "tslint:recommended",
      "rules": {
        "align": {
          "options": [
            "parameters",
            "statements"
          ]
        },
        "array-type": false,
        "arrow-parens": false,
        "arrow-return-shorthand": true,
        "curly": true,
        "deprecation": {
          "severity": "warning"
        },
        "component-class-suffix": true,
        "contextual-lifecycle": true,
        "directive-class-suffix": true,
        "directive-selector": [
          true,
          "attribute",
          "vex",
          "camelCase"
        ],
        "component-selector": [
          true,
          "element",
          "vex",
          "kebab-case"
        ],
        "eofline": true,
        "import-blacklist": [
          true,
          "rxjs/Rx"
        ],
        "import-spacing": true,
        "indent": {
          "options": [
            "spaces"
          ]
        },
        "interface-name": false,
        "max-classes-per-file": false,
        "max-line-length": [
          true,
          140
        ],
        "member-access": false,
        "member-ordering": [
          true,
          {
            "order": [
              "static-field",
              "instance-field",
              "static-method",
              "instance-method"
            ]
          }
        ],
        "no-consecutive-blank-lines": false,
        "no-console": [
          true,
          "debug",
          "info",
          "time",
          "timeEnd",
          "trace"
        ],
        "no-empty": false,
        "no-inferrable-types": [
          true,
          "ignore-params"
        ],
        "no-non-null-assertion": true,
        "no-redundant-jsdoc": true,
        "no-switch-case-fall-through": true,
        "no-var-requires": false,
        "object-literal-key-quotes": [
          true,
          "as-needed"
        ],
        "object-literal-sort-keys": false,
        "ordered-imports": false,
        "quotemark": [
          true,
          "single"
        ],
        "semicolon": {
          "options": [
            "always"
          ]
        },
        "space-before-function-paren": {
          "options": {
            "anonymous": "never",
            "asyncArrow": "always",
            "constructor": "never",
            "method": "never",
            "named": "never"
          }
        },
        "trailing-comma": false,
        "no-conflicting-lifecycle": true,
        "no-host-metadata-property": false,
        "no-input-rename": true,
        "no-inputs-metadata-property": true,
        "no-output-native": true,
        "no-output-on-prefix": true,
        "no-output-rename": true,
        "no-outputs-metadata-property": true,
        "template-banana-in-box": true,
        "template-no-negated-async": true,
        "typedef-whitespace": {
          "options": [
            {
              "call-signature": "nospace",
              "index-signature": "nospace",
              "parameter": "nospace",
              "property-declaration": "nospace",
              "variable-declaration": "nospace"
            },
            {
              "call-signature": "onespace",
              "index-signature": "onespace",
              "parameter": "onespace",
              "property-declaration": "onespace",
              "variable-declaration": "onespace"
            }
          ]
        },
        "use-lifecycle-interface": true,
        "use-pipe-transform-interface": true,
        "variable-name": {
          "options": [
            "allow-pascal-case",
            "allow-leading-underscore"
          ]
        },
        "whitespace": {
          "options": [
            "check-branch",
            "check-decl",
            "check-operator",
            "check-separator",
            "check-type",
            "check-typecast"
          ]
        }
      },
      "rulesDirectory": [
        "codelyzer"
      ]
    }
    
    
    1 回复  |  直到 4 年前
        1
  •  1
  •   Modar Na    4 年前

    我不能确定,因为我没有Webstorm编辑器,但找到了这个 link

    在Webstorm设置中的导入和大括号之间添加空格:

    1. 展开左侧的编辑器菜单
    2. 如果使用的是TypeScript,请单击JavaScript或TypeScript
    3. 单击右侧内容区域中的“空间”选项卡
    4. 选择ES6导入/导出大括号
    5. 单击“应用”和“确定”关闭