Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-ember

Package Overview
Dependencies
Maintainers
5
Versions
189
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-ember - npm Package Compare versions

Comparing version 5.1.1 to 5.2.0

17

CHANGELOG.md
# Changelog
## v5.2.0 (2018-05-15)
#### :rocket: Enhancement
* [#142](https://github.com/ember-cli/eslint-plugin-ember/pull/142) Port code to ember-rfc176-data new format. ([@Serabe](https://github.com/Serabe))
* [#245](https://github.com/ember-cli/eslint-plugin-ember/pull/245) [avoid-leaking-state-in-ember-objects] Expose default ignored properties. ([@Kerrick](https://github.com/Kerrick))
#### :memo: Documentation
* [#208](https://github.com/ember-cli/eslint-plugin-ember/pull/208) Add URL to rule documentation to the metadata. ([@Arcanemagus](https://github.com/Arcanemagus))
#### :house: Internal
* [#142](https://github.com/ember-cli/eslint-plugin-ember/pull/142) Port code to ember-rfc176-data new format. ([@Serabe](https://github.com/Serabe))
#### Committers: 3
- Kerrick Long ([Kerrick](https://github.com/Kerrick))
- Landon Abney ([Arcanemagus](https://github.com/Arcanemagus))
- Sergio Arbeo ([Serabe](https://github.com/Serabe))
## v5.1.1 (2018-05-14)

@@ -4,0 +21,0 @@

3

lib/rules/alias-model-in-controller.js

@@ -15,3 +15,4 @@ 'use strict';

category: 'Best Practices',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/alias-model-in-controller.md'
},

@@ -18,0 +19,0 @@ fixable: null, // or "code" or "whitespace"

@@ -17,2 +17,3 @@ 'use strict';

replacedBy: ['avoid-leaking-state-in-ember-objects'],
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/avoid-leaking-state-in-components.md'
},

@@ -19,0 +20,0 @@ fixable: null, // or "code" or "whitespace"

@@ -42,3 +42,4 @@ 'use strict';

category: 'Ember Object',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/avoid-leaking-state-in-ember-objects.md'
},

@@ -52,2 +53,4 @@ fixable: null, // or "code" or "whitespace"

DEFAULT_IGNORED_PROPERTIES,
create(context) {

@@ -54,0 +57,0 @@ const ignoredProperties = context.options[0] || DEFAULT_IGNORED_PROPERTIES;

@@ -14,3 +14,4 @@ 'use strict';

category: 'Best Practices',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/closure-actions.md'
},

@@ -17,0 +18,0 @@ fixable: null, // or "code" or "whitespace"

@@ -15,3 +15,4 @@ 'use strict';

category: 'Possible Errors',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/jquery-ember-run.md'
},

@@ -18,0 +19,0 @@ fixable: null, // or "code" or "whitespace"

@@ -16,2 +16,3 @@ 'use strict';

replacedBy: ['new-module-imports'],
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/local-modules.md'
},

@@ -18,0 +19,0 @@ deprecated: true,

@@ -14,3 +14,4 @@ 'use strict';

category: 'Best Practices',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/named-functions-in-promises.md'
},

@@ -17,0 +18,0 @@ fixable: null, // or "code" or "whitespace"

'use strict';
const EMBER_NAMESPACES = ['inject.controller', 'inject.service'];
const GLOBALS = require('ember-rfc176-data/globals.json');
const MAPPING = require('ember-rfc176-data');
const GLOBALS = MAPPING.reduce((memo, exportDefinition) => {
if (exportDefinition.deprecated) {
return memo;
}
if (exportDefinition.global in memo) {
return memo;
}
memo[exportDefinition.global] = exportDefinition; // eslint-disable-line no-param-reassign
return memo;
}, Object.create(null));
//------------------------------------------------------------------------------

@@ -15,3 +29,4 @@ // General rule - Use "New Module Imports" from Ember RFC #176

category: 'Best Practices',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/new-module-imports.md'
},

@@ -36,3 +51,3 @@ },

const key = item.key.name;
const match = GLOBALS[key];
const match = GLOBALS[`Ember.${key}`];
populateMessage({

@@ -71,3 +86,3 @@ node: item,

const key = fullName.replace(/^Ember\./, '');
const match = GLOBALS[key];
const match = GLOBALS[fullName];

@@ -86,3 +101,3 @@ const reportedError = populateMessage({ node, fullName, key, match });

properties.forEach((item) => {
const match = GLOBALS[`${parent}.${item.key.name}`];
const match = GLOBALS[`Ember.${parent}.${item.key.name}`];

@@ -114,14 +129,16 @@ populateMessage({

const isNamedExport = obj.match.export !== 'default';
let importSpecifier;
let message;
if (obj.match[1] && !isNamespace) {
importSpecifier = obj.match[2] ? `{ ${obj.match[1]} as ${obj.match[2]} }` : `{ ${obj.match[1]} }`;
} else if (obj.match[1] && isNamespace) {
if (isNamedExport && !isNamespace) {
importSpecifier = obj.match.localName ? `{ ${obj.match.export} as ${obj.match.localName} }` : `{ ${obj.match.export} }`;
} else if (isNamedExport && isNamespace) {
importSpecifier = `{ ${obj.parent} as ${obj.key} }`;
} else {
importSpecifier = obj.match[2] || obj.customKey || obj.key;
importSpecifier = obj.match.localName || obj.customKey || obj.key;
}
const replacement = `import ${importSpecifier} from '${obj.match[0]}';`;
const replacement = `import ${importSpecifier} from '${obj.match.module}';`;

@@ -128,0 +145,0 @@ if (obj.type === 'Property') {

@@ -16,3 +16,4 @@ 'use strict';

category: 'Possible Errors',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-attrs-in-components.md'
},

@@ -19,0 +20,0 @@ fixable: null,

@@ -17,3 +17,4 @@ 'use strict';

category: 'Possible Errors',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-attrs-snapshot.md'
},

@@ -20,0 +21,0 @@ fixable: null, // or "code" or "whitespace"

@@ -16,2 +16,3 @@ 'use strict';

recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-capital-letters-in-routes.md'
},

@@ -18,0 +19,0 @@ fixable: null, // or "code" or "whitespace"

@@ -15,3 +15,4 @@ 'use strict';

category: 'Possible Errors',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-duplicate-dependent-keys.md'
},

@@ -18,0 +19,0 @@ fixable: null,

@@ -14,3 +14,4 @@ 'use strict';

category: 'Best Practices',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-empty-attrs.md'
},

@@ -17,0 +18,0 @@ fixable: null, // or "code" or "whitespace"

@@ -14,3 +14,4 @@ 'use strict';

category: 'Best Practices',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-function-prototype-extensions.md'
},

@@ -17,0 +18,0 @@ fixable: null, // or "code" or "whitespace"

@@ -19,2 +19,3 @@ 'use strict';

recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-global-jquery.md'
},

@@ -21,0 +22,0 @@ fixable: null, // or "code" or "whitespace"

@@ -18,3 +18,4 @@ 'use strict';

category: 'Best Practices',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-jquery.md'
},

@@ -21,0 +22,0 @@ fixable: null, // or "code" or "whitespace"

@@ -14,3 +14,4 @@ 'use strict';

category: 'Best Practices',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-observers.md'
},

@@ -17,0 +18,0 @@ fixable: null, // or "code" or "whitespace"

'use strict';
const oldShimsData = require('ember-rfc176-data/old-shims.json');
// inlined from
// https://github.com/ember-cli/ember-rfc176-data/blob/v0.2.7/old-shims.json
// the newer format of ember-rfc176-data no longer supports the distinction
// between "old shim" and "generally deprecated"
const oldShimsData = {
'ember-application': {
default: ['@ember/application']
},
'ember-array': {
default: ['@ember/array']
},
'ember-array/mutable': {
default: ['@ember/array/mutable']
},
'ember-array/utils': {
A: ['@ember/array', 'A'],
isEmberArray: ['@ember/array', 'isArray'],
wrap: ['@ember/array', 'makeArray']
},
'ember-component': {
default: ['@ember/component']
},
'ember-components/checkbox': {
default: ['@ember/component/checkbox']
},
'ember-components/text-area': {
default: ['@ember/component/text-area']
},
'ember-components/text-field': {
default: ['@ember/component/text-field']
},
'ember-controller': {
default: ['@ember/controller']
},
'ember-controller/inject': {
default: ['@ember/controller', 'inject']
},
'ember-controller/proxy': {
default: ['@ember/array/proxy']
},
'ember-controllers/sortable': {
default: null
},
'ember-debug': {
log: ['@ember/debug', 'debug'],
inspect: ['@ember/debug', 'inspect'],
run: ['@ember/debug', 'runInDebug'],
warn: ['@ember/debug', 'warn']
},
'ember-debug/container-debug-adapter': {
default: ['@ember/debug/container-debug-adapter']
},
'ember-debug/data-adapter': {
default: ['@ember/debug/data-adapter']
},
'ember-deprecations': {
deprecate: ['@ember/application/deprecations', 'deprecate'],
deprecateFunc: ['@ember/application/deprecations', 'deprecateFunc']
},
'ember-enumerable': {
default: ['@ember/enumerable']
},
'ember-evented': {
default: ['@ember/object/evented']
},
'ember-evented/on': {
default: ['@ember/object/evented', 'on']
},
'ember-globals-resolver': {
default: ['@ember/application/globals-resolver', null, 'GlobalsResolver']
},
'ember-helper': {
default: ['@ember/component/helper'],
helper: ['@ember/component/helper', 'helper']
},
'ember-instrumentation': {
instrument: ['@ember/instrumentation', 'instrument'],
reset: ['@ember/instrumentation', 'reset'],
subscribe: ['@ember/instrumentation', 'subscribe'],
unsubscribe: ['@ember/instrumentation', 'unsubscribe']
},
'ember-locations/hash': {
default: ['@ember/routing/hash-location']
},
'ember-locations/history': {
default: ['@ember/routing/history-location']
},
'ember-locations/none': {
default: ['@ember/routing/none-location']
},
'ember-map': {
default: ['@ember/map'],
withDefault: ['@ember/map/with-default']
},
'ember-metal/destroy': {
default: null
},
'ember-metal/events': {
addListener: ['@ember/object/events', 'addListener'],
removeListener: ['@ember/object/events', 'removeListener'],
send: ['@ember/object/events', 'sendEvent']
},
'ember-metal/get': {
default: ['@ember/object', 'get'],
getProperties: ['@ember/object', 'getProperties']
},
'ember-metal/mixin': {
default: ['@ember/object/mixin']
},
'ember-metal/observer': {
default: ['@ember/object', 'observer'],
addObserver: ['@ember/object/observers', 'addObserver'],
removeObserver: ['@ember/object/observers', 'removeObserver']
},
'ember-metal/on-load': {
default: ['@ember/application', 'onLoad'],
run: ['@ember/application', 'runLoadHooks']
},
'ember-metal/set': {
default: ['@ember/object', 'set'],
setProperties: ['@ember/object', 'setProperties'],
trySet: ['@ember/object', 'trySet']
},
'ember-metal/utils': {
aliasMethod: ['@ember/object', 'aliasMethod'],
assert: ['@ember/debug', 'assert'],
cacheFor: ['@ember/object/internals', 'cacheFor'],
copy: ['@ember/object/internals', 'copy'],
guidFor: ['@ember/object/internals', 'guidFor']
},
'ember-object': {
default: ['@ember/object']
},
'ember-owner/get': {
default: ['@ember/application', 'getOwner']
},
'ember-owner/set': {
default: ['@ember/application', 'setOwner']
},
'ember-platform': {
assign: ['@ember/polyfills', 'assign'],
create: ['@ember/polyfills', 'create'],
hasAccessors: ['@ember/polyfills', 'hasPropertyAccessors'],
keys: ['@ember/polyfills', 'keys']
},
'ember-route': {
default: ['@ember/routing/route']
},
'ember-router': {
default: ['@ember/routing/router']
},
'ember-runloop': {
default: ['@ember/runloop', 'run'],
begin: ['@ember/runloop', 'begin'],
bind: ['@ember/runloop', 'bind'],
cancel: ['@ember/runloop', 'cancel'],
debounce: ['@ember/runloop', 'debounce'],
end: ['@ember/runloop', 'end'],
join: ['@ember/runloop', 'join'],
later: ['@ember/runloop', 'later'],
next: ['@ember/runloop', 'next'],
once: ['@ember/runloop', 'once'],
schedule: ['@ember/runloop', 'schedule'],
scheduleOnce: ['@ember/runloop', 'scheduleOnce'],
throttle: ['@ember/runloop', 'throttle']
},
'ember-service': {
default: ['@ember/service']
},
'ember-service/inject': {
default: ['@ember/service', 'inject']
},
'ember-set/ordered': {
default: null
},
'ember-string': {
camelize: ['@ember/string', 'camelize'],
capitalize: ['@ember/string', 'capitalize'],
classify: ['@ember/string', 'classify'],
dasherize: ['@ember/string', 'dasherize'],
decamelize: ['@ember/string', 'decamelize'],
fmt: ['@ember/string', 'fmt'],
htmlSafe: ['@ember/string', 'htmlSafe'],
loc: ['@ember/string', 'loc'],
underscore: ['@ember/string', 'underscore'],
w: ['@ember/string', 'w']
},
'ember-utils': {
isBlank: ['@ember/utils', 'isBlank'],
isEmpty: ['@ember/utils', 'isEmpty'],
isNone: ['@ember/utils', 'isNone'],
isPresent: ['@ember/utils', 'isPresent'],
tryInvoke: ['@ember/utils', 'tryInvoke'],
typeOf: ['@ember/utils', 'typeOf']
},
'ember-computed': {
default: ['@ember/object', 'computed'],
empty: ['@ember/object/computed', 'empty'],
notEmpty: ['@ember/object/computed', 'notEmpty'],
none: ['@ember/object/computed', 'none'],
not: ['@ember/object/computed', 'not'],
bool: ['@ember/object/computed', 'bool'],
match: ['@ember/object/computed', 'match'],
equal: ['@ember/object/computed', 'equal'],
gt: ['@ember/object/computed', 'gt'],
gte: ['@ember/object/computed', 'gte'],
lt: ['@ember/object/computed', 'lt'],
lte: ['@ember/object/computed', 'lte'],
alias: ['@ember/object/computed', 'alias'],
oneWay: ['@ember/object/computed', 'oneWay'],
reads: ['@ember/object/computed', 'reads'],
readOnly: ['@ember/object/computed', 'readOnly'],
deprecatingAlias: ['@ember/object/computed', 'deprecatingAlias'],
and: ['@ember/object/computed', 'and'],
or: ['@ember/object/computed', 'or'],
collect: ['@ember/object/computed', 'collect'],
sum: ['@ember/object/computed', 'sum'],
min: ['@ember/object/computed', 'min'],
max: ['@ember/object/computed', 'max'],
map: ['@ember/object/computed', 'map'],
sort: ['@ember/object/computed', 'sort'],
setDiff: ['@ember/object/computed', 'setDiff'],
mapBy: ['@ember/object/computed', 'mapBy'],
mapProperty: ['@ember/object/computed', 'mapProperty'],
filter: ['@ember/object/computed', 'filter'],
filterBy: ['@ember/object/computed', 'filterBy'],
filterProperty: ['@ember/object/computed', 'filterProperty'],
uniq: ['@ember/object/computed', 'uniq'],
union: ['@ember/object/computed', 'union'],
intersect: ['@ember/object/computed', 'intersect']
},
'ember-test': {
default: null
},
'ember-test/adapter': {
default: ['@ember/test/adapter']
},
'ember-test/qunit-adapter': {
default: null
}
};

@@ -14,3 +254,4 @@ //------------------------------------------------------------------------------

category: 'Best Practices',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-old-shims.md'
},

@@ -17,0 +258,0 @@ fixable: 'code',

@@ -15,3 +15,4 @@ 'use strict';

category: 'Best Practices',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-on-calls-in-components.md'
},

@@ -18,0 +19,0 @@ fixable: null, // or "code" or "whitespace"

@@ -14,3 +14,4 @@ 'use strict';

category: 'Possible Errors',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/no-side-effects.md'
},

@@ -17,0 +18,0 @@ fixable: null, // or "code" or "whitespace"

@@ -41,3 +41,4 @@ 'use strict';

category: 'Stylistic Issues',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/order-in-components.md'
},

@@ -44,0 +45,0 @@ fixable: 'code' // or "code" or "whitespace"

@@ -32,3 +32,4 @@ 'use strict';

category: 'Stylistic Issues',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/order-in-controllers.md'
},

@@ -35,0 +36,0 @@ fixable: 'code', // or "code" or "whitespace"

@@ -26,3 +26,4 @@ 'use strict';

category: 'Stylistic Issues',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/order-in-models.md'
},

@@ -29,0 +30,0 @@ fixable: 'code', // or "code" or "whitespace"

@@ -39,3 +39,4 @@ 'use strict';

category: 'Stylistic Issues',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/order-in-routes.md'
},

@@ -42,0 +43,0 @@ fixable: 'code' // or "code" or "whitespace"

@@ -67,3 +67,4 @@ 'use strict';

category: 'Possible Errors',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/require-super-in-init.md'
},

@@ -70,0 +71,0 @@ fixable: null, // or "code" or "whitespace"

@@ -16,3 +16,4 @@ 'use strict';

category: 'Possible Errors',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/routes-segments-snake-case.md'
},

@@ -19,0 +20,0 @@ fixable: null, // or "code" or "whitespace"

@@ -15,3 +15,4 @@ 'use strict';

category: 'Stylistic Issues',
recommended: true
recommended: true,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/use-brace-expansion.md'
},

@@ -18,0 +19,0 @@ fixable: null, // or "code" or "whitespace"

@@ -20,3 +20,4 @@ 'use strict';

category: 'Best Practices',
recommended: false
recommended: false,
url: 'https://github.com/ember-cli/eslint-plugin-ember/tree/master/docs/rules/use-ember-get-and-set.md'
},

@@ -23,0 +24,0 @@ fixable: 'code',

{
"name": "eslint-plugin-ember",
"version": "5.1.1",
"version": "5.2.0",
"description": "Eslint plugin for Ember.js apps",

@@ -58,3 +58,3 @@ "main": "lib/index.js",

"dependencies": {
"ember-rfc176-data": "^0.2.7",
"ember-rfc176-data": "^0.3.3",
"snake-case": "^2.1.0"

@@ -61,0 +61,0 @@ },

@@ -12,2 +12,18 @@ // ------------------------------------------------------------------------------

describe('imports', () => {
it('should expose the default ignored properties', () => {
expect(rule.DEFAULT_IGNORED_PROPERTIES).toEqual([
'classNames',
'classNameBindings',
'actions',
'concatenatedProperties',
'mergedProperties',
'positionalParams',
'attributeBindings',
'queryParams',
'attrs',
]);
});
});
const eslintTester = new RuleTester({

@@ -14,0 +30,0 @@ parserOptions: {

@@ -25,3 +25,3 @@ // ------------------------------------------------------------------------------

{ code: 'Ember.MODEL_FACTORY_INJECTIONS = true;' },
{ code: 'console.log(Ember.VERSION);' },
{ code: 'console.log(Ember.SOMETHING_NO_ONE_USES);' },
{ code: 'if (Ember.testing) {}' },

@@ -84,3 +84,3 @@ {

{ message: 'Use import Component from \'@ember/component\'; instead of using Ember destructuring', line: 3 },
{ message: 'Use import { htmlSafe } from \'@ember/string\'; instead of using Ember destructuring', line: 3 }
{ message: 'Use import { htmlSafe } from \'@ember/template\'; instead of using Ember destructuring', line: 3 }
]

@@ -87,0 +87,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc