eslint-plugin-ember
Advanced tools
Comparing version 7.8.1 to 7.9.0
@@ -22,2 +22,3 @@ 'use strict'; | ||
'no-classic-components': require('./rules/no-classic-components'), | ||
'no-component-lifecycle-hooks': require('./rules/no-component-lifecycle-hooks'), | ||
'no-computed-properties-in-native-classes': require('./rules/no-computed-properties-in-native-classes'), | ||
@@ -37,2 +38,3 @@ 'no-controllers': require('./rules/no-controllers'), | ||
'no-jquery': require('./rules/no-jquery'), | ||
'no-legacy-test-waiters': require('./rules/no-legacy-test-waiters'), | ||
'no-new-mixins': require('./rules/no-new-mixins'), | ||
@@ -39,0 +41,0 @@ 'no-observers': require('./rules/no-observers'), |
@@ -13,2 +13,3 @@ /* | ||
"ember/no-classic-components": "error", | ||
"ember/no-component-lifecycle-hooks": "error", | ||
"ember/no-computed-properties-in-native-classes": "error", | ||
@@ -15,0 +16,0 @@ "ember/no-get-with-default": "error", |
@@ -25,2 +25,3 @@ /* | ||
"ember/no-classic-components": "off", | ||
"ember/no-component-lifecycle-hooks": "off", | ||
"ember/no-computed-properties-in-native-classes": "off", | ||
@@ -40,2 +41,3 @@ "ember/no-controllers": "off", | ||
"ember/no-jquery": "off", | ||
"ember/no-legacy-test-waiters": "off", | ||
"ember/no-new-mixins": "error", | ||
@@ -42,0 +44,0 @@ "ember/no-observers": "error", |
@@ -16,2 +16,3 @@ 'use strict'; | ||
isEmberComponent, | ||
isGlimmerComponent, | ||
isEmberController, | ||
@@ -67,2 +68,3 @@ isEmberMixin, | ||
Component: '@ember/component', | ||
GlimmerComponent: '@glimmer/component', | ||
Controller: '@ember/controller', | ||
@@ -204,2 +206,6 @@ Mixin: '@ember/object/mixin', | ||
function isGlimmerComponent(context, node) { | ||
return isEmberCoreModule(context, node, 'GlimmerComponent'); | ||
} | ||
function isEmberController(context, node) { | ||
@@ -206,0 +212,0 @@ return isEmberCoreModule(context, node, 'Controller'); |
@@ -14,2 +14,3 @@ 'use strict'; | ||
getSourceModuleName, | ||
getImportIdentifier, | ||
}; | ||
@@ -53,1 +54,31 @@ | ||
} | ||
/** | ||
* Gets an import identifier (either imported or local name) from the specified ImportDeclaration. | ||
* | ||
* @param {node} node the ImportDeclaration to find the import identifier for | ||
* @param {string} source the source, or module name string, of the import | ||
* @param {string} [namedImportIdentifier=null] the named import identifier to find (will return the alias of the import, of found) | ||
* @returns {null} if no import is found with that name | ||
*/ | ||
function getImportIdentifier(node, source, namedImportIdentifier = null) { | ||
assert( | ||
isImportDeclaration(node), | ||
`getImportIdentifier should be called with a node that's type is 'ImportDeclaration'. You passed '${node.type}'` | ||
); | ||
if (node.source.value !== source) { | ||
return null; | ||
} | ||
return node.specifiers | ||
.filter(specifier => { | ||
return ( | ||
(specifier.type === 'ImportSpecifier' && | ||
specifier.imported.name === namedImportIdentifier) || | ||
(!namedImportIdentifier && specifier.type === 'ImportDefaultSpecifier') | ||
); | ||
}) | ||
.map(specifier => specifier.local.name) | ||
.pop(); | ||
} |
{ | ||
"name": "eslint-plugin-ember", | ||
"version": "7.8.1", | ||
"version": "7.9.0", | ||
"description": "Eslint plugin for Ember.js apps", | ||
@@ -15,4 +15,5 @@ "main": "lib/index.js", | ||
"changelog": "lerna-changelog", | ||
"lint": "yarn lint:js && yarn lint:docs", | ||
"lint:docs": "yarn markdownlint docs/**/*.md", | ||
"lint": "npm-run-all lint:* --continue-on-error", | ||
"lint:docs": "markdownlint '**/*.md' -i CHANGELOG.md -i LICENSE.md -i node_modules", | ||
"lint:docs-js": "eslint . --cache --ext md", | ||
"lint:js": "eslint . --cache", | ||
@@ -56,3 +57,3 @@ "start": "yarn run test:watch", | ||
"devDependencies": { | ||
"babel-eslint": "^10.0.3", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^6.8.0", | ||
@@ -64,3 +65,4 @@ "eslint-config-prettier": "^6.10.0", | ||
"eslint-plugin-import": "^2.20.1", | ||
"eslint-plugin-jest": "^23.7.0", | ||
"eslint-plugin-jest": "^23.8.0", | ||
"eslint-plugin-markdown": "^1.0.2", | ||
"eslint-plugin-node": "^11.0.0", | ||
@@ -72,2 +74,3 @@ "eslint-plugin-prettier": "^3.1.2", | ||
"markdownlint-cli": "^0.21.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "1.19.1" | ||
@@ -74,0 +77,0 @@ }, |
@@ -9,3 +9,3 @@ # eslint-plugin-ember | ||
## ❗️ Requirements | ||
## ❗️Requirements | ||
@@ -20,10 +20,12 @@ - [ESLint](https://eslint.org/) `>= 5` | ||
```shell | ||
yarn add --dev eslint-plugin-ember | ||
yarn add --dev eslint-plugin-ember | ||
``` | ||
Or | ||
```shell | ||
npm install --save-dev eslint-plugin-ember | ||
npm install --save-dev eslint-plugin-ember | ||
``` | ||
### 2. Modify your `.eslintrc.js`: | ||
### 2. Modify your `.eslintrc.js` | ||
@@ -33,5 +35,3 @@ ```javascript | ||
module.exports = { | ||
plugins: [ | ||
'ember' | ||
], | ||
plugins: ['ember'], | ||
extends: [ | ||
@@ -45,3 +45,3 @@ 'eslint:recommended', | ||
} | ||
} | ||
}; | ||
``` | ||
@@ -93,3 +93,2 @@ | ||
### Ember Object | ||
@@ -105,3 +104,2 @@ | ||
### Possible Errors | ||
@@ -128,3 +126,2 @@ | ||
### Ember Octane | ||
@@ -137,6 +134,6 @@ | ||
| :car: | [no-classic-components](./docs/rules/no-classic-components.md) | enforce using Glimmer components | | ||
| :car: | [no-component-lifecycle-hooks](./docs/rules/no-component-lifecycle-hooks.md) | disallow usage of "classic" ember component lifecycle hooks. Render modifiers or custom functional modifiers should be used instead. | | ||
| :car: | [no-computed-properties-in-native-classes](./docs/rules/no-computed-properties-in-native-classes.md) | disallow using computed properties in native classes | | ||
| :car: | [require-tagless-components](./docs/rules/require-tagless-components.md) | disallow using the wrapper element of a component | | ||
### Ember Data | ||
@@ -149,3 +146,2 @@ | ||
### Testing | ||
@@ -155,2 +151,3 @@ | ||
|:---|:--------|:------------| | ||
| | [no-legacy-test-waiters](./docs/rules/no-legacy-test-waiters.md) | disallow the use of the legacy test waiter APIs. | | ||
| | [no-pause-test](./docs/rules/no-pause-test.md) | disallow usage of the `pauseTest` helper in tests | | ||
@@ -161,3 +158,2 @@ | | [no-test-and-then](./docs/rules/no-test-and-then.md) | disallow usage of the `andThen` test wait helper | | ||
### Stylistic Issues | ||
@@ -180,2 +176,3 @@ | ||
In order to add a new rule, you should: | ||
- [Create an issue](https://github.com/ember-cli/eslint-plugin-ember/issues/new) on GitHub with description of proposed rule | ||
@@ -193,2 +190,3 @@ - Generate a new rule using the [official yeoman generator](https://github.com/eslint/generator-eslint) | ||
## ⭐️ Contributors | ||
- [Adrian Zalewski](https://github.com/bardzusny) | ||
@@ -206,3 +204,4 @@ - [Alex LaFroscia](https://github.com/alexlafroscia) | ||
## 🙌 Credits | ||
## 🙌 Credits | ||
- [DockYard team](http://github.com/DockYard) - for great inspiration with their [styleguide](https://github.com/DockYard/styleguides/blob/master/engineering/ember.md) | ||
@@ -209,0 +208,0 @@ - [Rob Hilgefort](https://github.com/rjhilgefort) - for making it possible to redeploy new plugin under existing `eslint-plugin-ember` package name |
Sorry, the diff of this file is too big to display
305046
79
6565
17
199