当前位置: 首页 > 软件库 > 程序开发 > >

ember-cli-eslint

授权协议 MIT License
开发语言 JavaScript
所属分类 程序开发
软件类型 开源软件
地区 不详
投 递 者 王念
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

ember-cli-eslint

ESLint for Ember CLI apps and addons

Installation

ESLint 4 (for Node 4 and above):

ember install ember-cli-eslint@4

ESLint 3 (for Node 4 and above):

ember install ember-cli-eslint@3

ESLint 2 (for Node 0.10 and above):

ember install ember-cli-eslint@2

After installation, an .eslintrc.js file will be placed in both the root ofyour project and the /tests directory.

Furthermore, a .eslintignore file can be used to exclude files fromlinting while the linter is running. Its syntax is identical to.gitignore files.

Disabling JSHint

Congratulations! You've made the leap into the next generation of JavaScriptlinting. At the moment, however, ember-cli defaults to generatingapplications and addons with a jshint configuration.

If you notice the two awkwardly running side by side, click here!

ember-cli >= 2.5.0

As of ember-cli v.2.5.0,jshint is provided through its own ember-cli-jshint addon.Running npm uninstall --save-dev ember-cli-jshint, in addition to removingany .jshintrc files from your project should guarantee that its behavioris disabled.

ember-cli < 2.5.0

Controlling linting is a bit trickier on versions of ember-cli prior to2.5.0. Within your ember-cli-build.js file, ember-cli-qunit orember-cli-mocha can be configured to have their default linting processdisabled during:

module.exports = function(defaults) {
  const app = new EmberApp(defaults, {
    'ember-cli-qunit': {
      useLintTree: false
    }
  });
};

or

module.exports = function(defaults) {
  const app = new EmberApp(defaults, {
    'ember-cli-mocha': {
      useLintTree: false
    }
  });
};

Alongside this setting, the hinting property can then be used toenable/disable globally:

const isTesting = process.env.EMBER_ENV === 'test';

module.exports = function(defaults) {
  const app = new EmberApp(defaults, {
    hinting: !isTesting,
  });
};

Usage

ESLint will be run by ember-cli-qunit or ember-cli-mocha automaticallywhen you run ember test. If ESLint is not being run automatically, tryupdating your ember-cli and/or ember-cli-qunit/ember-cli-mochadependencies.

Configuration

ember-cli-eslint can be configured through the eslint key in yourember-cli-build.js file:

let app = new EmberApp(defaults, {
  eslint: {
    testGenerator: 'qunit',
    group: true,
    rulesDir: 'eslint-rules',
    extensions: ['js'],
  }
});
  • testGenerator is automatically detected if ember-qunit/ember-cli-qunitor ember-mocha/ember-cli-mocha are used, but can also be set to qunitand mocha manually.

  • group can be set to false to go back to the previous behavior whereevery generated test was contained in its own separate module.

  • rulesDir is the name of the directory for your custom eslint rules.It defaults to eslint-rules.

  • extensions is an array containing the file extensions to lint. If you want to lint JavaScript and TypeScript files for example it should be set to ['js', 'ts']. NOTE: If you add Typescript files @typescript/eslint-parser has to be installed and specified as the parser. For more information take a look at the @typescript/eslint-parser

On Build Files

Please note that if you are using this to lint files which are part of the buildprocess (ie. index.js, ember-cli-build.js, config/), whether in an application oras part of an addon, they will not be linted. It is recommended that eslint issetup separately to lint these files and can be setup as an npm script and run aspart of a CI process.

Contributing

Installation

  • git clone this repository
  • cd ember-cli-eslint
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server
  • ember try:each

Linting

  • npm run lint:hbs
  • npm run lint:js
  • npm run lint:js -- --fix

Running the dummy application

For more information on using ember-cli, visit https://ember-cli.com/.

License

This project is licensed under the MIT License.

  • Use ESLint In Ember Project 在团队开发过程中,有个开发规范是一个应该也是很重要的事情,在前端开发的这么长的时间里,包括各大厂都有自己的一套规范,我们大可以将成熟的规范拿来作为我们的规范。 ESLint ESLint 是一个JavaScript 代码检测工具,目标是保证代码的一致性和避免错误。ESLint 有很多规则来保证代码的一致。所以配置一个可行合理的规则块是至关重要

  • ESlint 被设计为完全可配置的,这意味着你可以关闭每一个规则而只运行基本语法验证,或混合和匹配 ESLint 默认绑定的规则和你的自定义规则,以让 ESLint 更适合你的项目。有两种主要的方式来配置 ESLint: 1- 安装eslint npm i -g eslint 如果使用脚手架工具vue-cli 或者 dev-cli搭建的项目会自动生成配置eslint的文件,名字叫做.eslintr

 相关资料
  • Ember CLI 是一个 Ember.js 命令行工具,提供了由 broccoli 提供的快速的资源管道和项目结构。 Ember CLI 基于 Ember App Kit Project 目前已经废弃。 Assets Compilation Ember CLI asset compilation is based on broccoli. Broccoli has support for: Ha

  • This repository is no longer maintained. As a replacement check out: https://github.com/sir-dunxalot/ember-tooltips Ember CLI Tooltipster An Ember CLI add-on that wraps Tooltipster into an ember compo

  • ember-cli-updater This ember-cli addon helps you update your ember-cli application or addon. The idea of this addon is to automate some parts of the upgrade process so it's simplified. Not every chang

  • Ember-cli-yadda This Ember CLI addon facilitates writing BDD tests in the Gherkin language and executing them against your Ember app. @mschinis (Micheal Schinis) Did a great talk at @emberlondon BDD a

  • Ember-cli-simditor Ember component wrapper for simditor. Changes 0.0.7 Different from previous version, you must wrap content in object. See issue 6 for why. Getting Started Installation In your ember

  • ember-cli-chai Chai assertions for Ember.js. Deprecated This package is deprecated. Please use ember-auto-import to use chai and chai plugins directly. If you'd like to use chai, or were previously us