Skip to content

Commit

Permalink
Merge pull request #588 from bmish/rule-type-field
Browse files Browse the repository at this point in the history
Add `type` meta property to each rule
  • Loading branch information
bmish authored Nov 11, 2019
2 parents 0fa6293 + a91d574 commit 5a59424
Show file tree
Hide file tree
Showing 59 changed files with 58 additions and 1 deletion.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ module.exports = {
'eslint-plugin/require-meta-docs-url': ['error', {
pattern: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/{{name}}.md',
}],
'eslint-plugin/require-meta-type': 'off',
'eslint-plugin/test-case-property-ordering': 'off',

// Filenames:
Expand Down
1 change: 1 addition & 0 deletions lib/rules/alias-model-in-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const ember = require('../utils/ember');

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforces aliasing model in controller',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/avoid-leaking-state-in-ember-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function isAllowed(value) {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Avoids state leakage',
category: 'Ember Object',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/avoid-using-needs-in-controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const ember = require('../utils/ember');

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Avoids using needs in controllers',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/classic-decorator-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
ERROR_MESSAGE_CONSTRUCTOR_IN_CLASSIC,

meta: {
type: 'problem',
docs: {
description: 'Ensure correct hooks are used for both classic and non-classic classes',
category: 'Ember Object',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/classic-decorator-no-classic-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
disallowedMethodErrorMessage,

meta: {
type: 'problem',
docs: {
description:
"Prevent usage of classic APIs such as get/set in classes that aren't explicitly decorated with @classic",
Expand Down
1 change: 1 addition & 0 deletions lib/rules/closure-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ERROR_MESSAGE = 'Use closure actions';

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforces usage of closure actions',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/computed-property-getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const ALWAYS_WITH_SETTER_MESSAGE =

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforce the consistent use of getters in computed properties',
category: 'Ember Object',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/jquery-ember-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ember = require('../utils/ember');

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Prevents usage of jQuery without Ember Run Loop',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/named-functions-in-promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const types = require('../utils/types');

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforces usage of named functions in promises',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/new-module-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const GLOBALS = MAPPING.reduce((memo, exportDefinition) => {

module.exports = {
meta: {
type: 'problem',
docs: {
description: ' Use "New Module Imports" from Ember RFC #176',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-actions-hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const ERROR_MESSAGE = 'Use the @action decorator instead of declaring an actions
module.exports = {
ERROR_MESSAGE,
meta: {
type: 'suggestion',
docs: {
description: 'Disallows the actions hash in components, controllers and routes',
category: 'Ember Octane',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-arrow-function-computed-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
ERROR_MESSAGE,

meta: {
type: 'problem',
docs: {
description: 'Disallows arrow functions in computed properties',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-attrs-in-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const MESSAGE = 'Do not use this.attrs';

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Disallow usage of this.attrs in components',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-attrs-snapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const ERROR_MESSAGE =

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Disallow use of attrs snapshot in `didReceiveAttrs` and `didUpdateAttrs`',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-capital-letters-in-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const types = require('../utils/types');

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Raise an error when there is a route with uppercased letters in router.js',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-classic-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
ERROR_MESSAGE_NO_CLASSIC_CLASSES,

meta: {
type: 'suggestion',
docs: {
description: 'Disallow "classic" classes in favor of native JS classes',
category: 'Ember Octane',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-classic-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const ERROR_MESSAGE =

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Enforces Glimmer components',
category: 'Ember Octane',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-computed-properties-in-native-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function findComputedNodes(nodeBody) {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallows using computed properties in native classes',
category: 'Ember Octane',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-deeply-nested-dependent-keys-with-each.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ERROR_MESSAGE =

module.exports = {
meta: {
type: 'problem',
docs: {
description:
'Disallows usage of deeply-nested computed property dependent keys with `@each`.',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-duplicate-dependent-keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const ERROR_MESSAGE = 'Dependent keys should not be repeated';

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Disallow repeating dependent keys',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-ember-super-in-es-classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Prevents use of `this._super` in ES class methods',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-ember-testing-in-module-scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ERROR_MESSAGES = [

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Prevents use of Ember.testing in module scope',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-empty-attrs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const ember = require('../utils/ember');

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevents usage of empty attributes in ember data models',
category: 'Ember Data',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-function-prototype-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const types = require('../utils/types');

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: "Prevents usage of Ember's `function` prototype extensions",
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
makeErrorMessageForGet,
ERROR_MESSAGE_GET_PROPERTIES,
meta: {
type: 'suggestion',
docs: {
description: "Require ES5 getters instead of Ember's `get` / `getProperties` functions",
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-global-jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const ERROR_MESSAGE = 'Do not use global `$` or `jQuery`';

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevents usage of global jQuery object',
category: 'Best Practices',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
ERROR_MESSAGE,

meta: {
type: 'problem',
docs: {
description:
'Disallows inline anonymous functions as arguments to `debounce`, `once`, and `scheduleOnce`',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-invalid-debug-function-arguments.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const DEBUG_FUNCTIONS = ['assert', 'deprecate', 'warn'];

module.exports = {
meta: {
type: 'problem',
docs: {
description:
"Catch usages of Ember's `assert()` / `warn()` / `deprecate()` functions that have the arguments passed in the wrong order.",
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const ALIASES = ['$', 'jQuery'];

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallow any usage of jQuery',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-new-mixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ERROR_MESSAGE = "Don't create new mixins";

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevents creation of new mixins',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-observers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const ember = require('../utils/ember');

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevents usage of observers',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-old-shims.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ const { buildFix } = require('../utils/new-module');

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevents usage of old shims for modules',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-on-calls-in-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const types = require('../utils/types');

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Prevents usage of `on` to call lifecycle hooks in components',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-pause-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ERROR_MESSAGE = 'Do not use `pauseTest()`';

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallow use of `pauseTest` helper in tests.',
category: 'Testing',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-proxies.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const ERROR_MESSAGE = 'Do not use array or object proxies.';

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallows using array or object proxies',
category: 'Ember Object',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-restricted-resolver-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function getLastArgument(node) {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Prevents the use of patterns that use the restricted resolver in tests.',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-side-effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function isUnallowedMethod(name) {

module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Warns about unexpected side effects in computed properties',
category: 'Possible Errors',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-test-and-then.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ERROR_MESSAGE = 'Use `await` instead of `andThen` test wait helper.';

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallow use of `andThen` test wait helper.',
category: 'Testing',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-test-import-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const NO_EXPORT_MESSAGE = 'No exports from test file. Any exports should be done

module.exports = {
meta: {
type: 'problem',
docs: {
description:
'Disallow importing of "-test.js" in a test file and exporting from a test file.',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-test-module-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const ERROR_MESSAGE = 'moduleFor* apis are are not allowed. Use `module` instead

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallow use of moduleFor, moduleForComponent, etc',
category: 'Testing',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-unnecessary-index-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ERROR_MESSAGE =

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallow unnecessary `index` route definition',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-unnecessary-route-path-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const ERROR_MESSAGE = 'Do not provide unnecessary `path` option which matches th

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallow unnecessary route `path` option',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-unnecessary-service-injection-argument.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const ERROR_MESSAGE =

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Disallow unnecessary argument when injecting service',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/no-volatile-computed-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
ERROR_MESSAGE,

meta: {
type: 'suggestion',
docs: {
description: 'Disallows volatile computed properties',
category: 'Best Practices',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/order-in-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const ORDER = [

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Enforces proper order of properties in components',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/order-in-controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const ORDER = [

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Enforces proper order of properties in controllers',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/order-in-models.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const ORDER = ['attribute', 'relationship', 'single-line-function', 'multi-line-

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Enforces proper order of properties in models',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/order-in-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const ORDER = [

module.exports = {
meta: {
type: 'layout',
docs: {
description: 'Enforces proper order of properties in routes',
category: 'Stylistic Issues',
Expand Down
1 change: 1 addition & 0 deletions lib/rules/require-computed-macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function getThisExpressions(nodeLogicalExpression) {

module.exports = {
meta: {
type: 'suggestion',
docs: {
description: 'Requires using computed property macros when possible',
category: 'Best Practices',
Expand Down
Loading

0 comments on commit 5a59424

Please sign in to comment.