3

如何在不使用任何其他工具的情况下使用Airbnb JavaScript 样式指南?我已经为我的 Eclipse 氧气安装了 Tern (Tern IDE)。我下载了最新版本的eslint-config-airbnb-base-v12.0.1并在
Project -> Properties -> Tern ->Validation -> ESLint 下选择了.eslintrc该版本中的文件。我的 Tern 配置存储在一个.tern-project文件中:

{
  "ecmaVersion": 6,
  "plugins": {
    "guess-types": {
      
    },
    "outline": {
      
    },
    "eslint": {
      "configFile": "C:\\dev\\workspace\\pyqt_web\\eslint-config-airbnb-base\\.eslintrc"
    },
    "browser-extension": {
      
    },
    "bootstrap": {
      
    }
  },
  "libs": [
    "browser",
    "jquery"
  ]
}

.eslintrc看起来像:

{
  "extends": "./index.js",
  "rules": {
    // disable requiring trailing commas because it might be nice to revert to
    // being JSON at some point, and I don't want to make big changes now.
    "comma-dangle": 0
  },
}

index.js

module.exports = {
  extends: [
    './rules/best-practices',
    './rules/errors',
    './rules/node',
    './rules/style',
    './rules/variables',
    './rules/es6',
    './rules/imports',
  ].map(require.resolve),
  parserOptions: {
    ecmaVersion: 2017,
    sourceType: 'module',
    ecmaFeatures: {
      experimentalObjectRestSpread: true,
    },
  },
  rules: {
    strict: 'error',
  },
};

从这里我不知道如何走得更远。我希望,我会收到与 airbnb 风格指南相匹配的新警告。这适用于 html 文件中的 js 代码吗?

4

0 回答 0