Socket
Socket
Sign inDemoInstall

ember-template-lint

Package Overview
Dependencies
Maintainers
7
Versions
215
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-template-lint - npm Package Compare versions

Comparing version 5.13.0 to 6.0.0-alpha.0

lib/config/5-x-recommended.js

1

bin/ember-template-lint.js
#!/usr/bin/env node
/* eslint require-atomic-updates:"off" */
/* eslint node/shebang:"off" -- shebang needed so this script can be run directly */

@@ -5,0 +4,0 @@ // Use V8's code cache to speed up instantiation time:

// STOP: This file is autogenerated by: npm run update:indices
import _4xrecommended from './4-x-recommended.js';
import _5xrecommended from './5-x-recommended.js';
import a11y from './a11y.js';

@@ -9,3 +9,3 @@ import recommended from './recommended.js';

export default {
'4-x-recommended': _4xrecommended,
'5-x-recommended': _5xrecommended,
a11y,

@@ -12,0 +12,0 @@ recommended,

@@ -11,2 +11,3 @@ export default {

'no-action': 'error',
'no-action-on-submit-button': 'error',
'no-args-paths': 'error',

@@ -17,5 +18,7 @@ 'no-arguments-for-html-elements': 'error',

'no-array-prototype-extensions': 'error',
'no-at-ember-render-modifiers': 'error',
'no-attrs-in-components': 'error',
'no-autofocus-attribute': 'error',
'no-block-params-for-html-elements': 'error',
'no-builtin-form-components': 'error',
'no-capital-arguments': 'error',

@@ -71,2 +74,4 @@ 'no-class-bindings': 'error',

'no-unnecessary-component-helper': 'error',
'no-unnecessary-curly-parens': 'error',
'no-unnecessary-curly-strings': 'error',
'no-unsupported-role-attributes': 'error',

@@ -92,2 +97,3 @@ 'no-unused-block-params': 'error',

'require-valid-named-block-naming-format': 'error',
'simple-modifiers': 'error',
'simple-unless': 'error',

@@ -94,0 +100,0 @@ 'splat-attributes-only': 'error',

@@ -131,3 +131,3 @@ import { parseTemplates } from 'ember-template-imports/lib/parse-templates.js';

const contentBeforeTemplateStart = text.slice(0, offset).split('\n');
const lineBeforeTemplateStart = contentBeforeTemplateStart[contentBeforeTemplateStart.length - 1];
const lineBeforeTemplateStart = contentBeforeTemplateStart.at(-1);
return {

@@ -134,0 +134,0 @@ line: contentBeforeTemplateStart.length,

@@ -8,4 +8,4 @@ // Implementation taken from `Ember.String.camelize`.

return string
.replace(REG_EXP_SYMBOLS, (match, separator, char) => (char ? char.toUpperCase() : ''))
.replace(REG_EXP_LETTERS, (match) => match.toLowerCase());
.replaceAll(REG_EXP_SYMBOLS, (match, separator, char) => (char ? char.toUpperCase() : ''))
.replaceAll(REG_EXP_LETTERS, (match) => match.toLowerCase());
}

@@ -27,3 +27,3 @@ function transformTagName(tagName, isLocal) {

tagName = tagName.replace(SIMPLE_DASHERIZE_REGEXP, (char, index) => {
tagName = tagName.replaceAll(SIMPLE_DASHERIZE_REGEXP, (char, index) => {
if (char === '/') {

@@ -40,5 +40,5 @@ return '::';

// Remove all occurrences of '-'s from the tagName
return tagName.replace(/-/g, '');
return tagName.replaceAll('-', '');
}
export { transformTagName, isNestedComponentTagName };

@@ -10,3 +10,3 @@ /*

return key
.replace(SIMPLE_DASHERIZE_REGEXP, (char, index) => {
.replaceAll(SIMPLE_DASHERIZE_REGEXP, (char, index) => {
if (index === 0 || !ALPHA.test(key[index - 1])) {

@@ -18,3 +18,3 @@ return char.toLowerCase();

})
.replace(/::/g, '/');
.replaceAll('::', '/');
}

@@ -82,4 +82,4 @@ function getLocalName(node) {

if (!this.hasPartial && this.locals.length > 0) {
if (!this.usedLocals[this.locals[this.locals.length - 1]]) {
return this.locals[this.locals.length - 1];
if (!this.usedLocals[this.locals.at(-1)]) {
return this.locals.at(-1);
}

@@ -110,3 +110,3 @@ } else {

frameHasUnusedBlockParams() {
return this.frames[this.frames.length - 1].unusedLocals();
return this.frames.at(-1).unusedLocals();
}

@@ -146,3 +146,3 @@

get currentNode() {
let currentFrame = this.frames[this.frames.length - 1];
let currentFrame = this.frames.at(-1);

@@ -149,0 +149,0 @@ return currentFrame && currentFrame.node;

@@ -23,3 +23,3 @@ import DEPRECATED_RULES from '../helpers/deprecated-rules.js';

function last(array) {
return array[array.length - 1];
return array.at(-1);
}

@@ -34,3 +34,3 @@

let firstLetter = str[0];
let lastLetter = str[str.length - 1];
let lastLetter = str.at(-1);
if (firstLetter === lastLetter && ['"', "'"].includes(firstLetter)) {

@@ -37,0 +37,0 @@ return str.slice(1, -1);

@@ -132,3 +132,3 @@ import createErrorMessage from '../helpers/create-error-message.js';

*/
paramOrHashPairEndLoc = node.params[node.params.length - 1].loc.end;
paramOrHashPairEndLoc = node.params.at(-1).loc.end;
}

@@ -404,4 +404,4 @@

: node.type === 'MustacheStatement' && !node.escaped
? 3
: 2;
? 3
: 2;

@@ -591,3 +591,3 @@ const actualStartLocation = {

if (node.children.length) {
const lastChild = node.children[node.children.length - 1];
const lastChild = node.children.at(-1);
const expectedStartLine =

@@ -594,0 +594,0 @@ lastChild.type === 'BlockStatement'

@@ -252,4 +252,4 @@ import { builders as b } from 'ember-template-recast';

: node.name.startsWith('...')
? TokenType.SPLATTRIBUTES
: TokenType.ATTRIBUTES;
? TokenType.SPLATTRIBUTES
: TokenType.ATTRIBUTES;
}

@@ -256,0 +256,0 @@

@@ -602,3 +602,3 @@ /*

let lines = sibling.chars.split(/[\n\r]/);
let lastLine = lines[lines.length - 1];
let lastLine = lines.at(-1);
if (lastLine.trim()) {

@@ -605,0 +605,0 @@ // The last line in this text node has non-whitespace content, so

@@ -81,3 +81,3 @@ import { builders as b } from 'ember-template-recast';

let lastNode = node.body[node.body.length - 1];
let lastNode = node.body.at(-1);

@@ -104,3 +104,3 @@ if (this.mode === 'fix') {

let lastChar = source[source.length - 1];
let lastChar = source.at(-1);
switch (this.config) {

@@ -107,0 +107,0 @@ case 'always': {

@@ -93,3 +93,3 @@ import { builders } from 'ember-template-recast';

? // normalize whitespace between values
oldRel.value.chars.trim().replace(/\s+/g, '')
oldRel.value.chars.trim().replaceAll(/\s+/g, '')
: '';

@@ -99,3 +99,3 @@

// the order the rule suggests in the error message
let newRelValue = oldRelValue.replace(/(noopener|noreferrer)/g, '');
let newRelValue = oldRelValue.replaceAll(/(noopener|noreferrer)/g, '');
newRelValue = `${newRelValue} noopener noreferrer`;

@@ -102,0 +102,0 @@

@@ -21,3 +21,3 @@ import AstNodeInfo from '../helpers/ast-node-info.js';

if (this.conditionals.length > 0) {
let parentConditional = this.conditionals[this.conditionals.length - 1];
let parentConditional = this.conditionals.at(-1);
for (const id of idsWithinConditional) {

@@ -52,6 +52,6 @@ parentConditional.add(id);

addId(id) {
this.seenIdStack[this.seenIdStack.length - 1].add(id);
this.seenIdStack.at(-1).add(id);
if (this.conditionals.length > 0) {
let currentConditional = this.conditionals[this.conditionals.length - 1];
let currentConditional = this.conditionals.at(-1);
currentConditional.add(id);

@@ -58,0 +58,0 @@ }

@@ -10,3 +10,3 @@ import AstNodeInfo from '../helpers/ast-node-info.js';

function hasText(textNode) {
const nbspRemoved = textNode.chars.replace(/ /g, ' ');
const nbspRemoved = textNode.chars.replaceAll(' ', ' ');
return nbspRemoved.trim().length > 0;

@@ -13,0 +13,0 @@ }

@@ -14,3 +14,3 @@ import AstNodeInfo from '../helpers/ast-node-info.js';

function getTrimmedText(text) {
const nbspRemoved = text.replace(/ /g, ' ');
const nbspRemoved = text.replaceAll(' ', ' ');
return nbspRemoved.toLowerCase().trim();

@@ -17,0 +17,0 @@ }

@@ -141,20 +141,35 @@ import AstNodeInfo from '../helpers/ast-node-info.js';

// https://www.w3.org/TR/wai-aria/#document_structure_roles
const DOCUMENT_STRUCTURE_ROLES = new Set([
'application',
'article',
'associationlist',
'associationlistitemkey',
'associationlistitemvalue',
'blockquote',
'caption',
'cell',
'code',
'columnheader',
'comment',
'definition',
'deletion',
'directory',
'document',
'emphasis',
'feed',
'figure',
'generic',
'group',
'heading',
'img',
'insertion',
'list',
'listitem',
'mark',
'math',
'meter',
'none',
'note',
'paragraph',
'presentation',

@@ -165,4 +180,9 @@ 'row',

'separator', // When not focusable
'strong',
'subscript',
'suggestion',
'superscript',
'table',
'term',
'time',
'toolbar',

@@ -169,0 +189,0 @@ 'tooltip',

@@ -13,4 +13,3 @@ import Rule from './_base.js';

// Swallow the final newline, as some editors add it automatically and we don't want it to cause an issue
let allLines =
this.source[this.source.length - 1] === '' ? this.source.slice(0, -1) : this.source;
let allLines = this.source.at(-1) === '' ? this.source.slice(0, -1) : this.source;

@@ -17,0 +16,0 @@ return {

@@ -197,6 +197,6 @@ import AstNodeInfo from '../helpers/ast-node-info.js';

: isUnless
? ERROR_MESSAGE_USE_IF
: shouldFlipCondition
? ERROR_MESSAGE_FLIP_IF
: ERROR_MESSAGE_USE_UNLESS;
? ERROR_MESSAGE_USE_IF
: shouldFlipCondition
? ERROR_MESSAGE_FLIP_IF
: ERROR_MESSAGE_USE_UNLESS;

@@ -203,0 +203,0 @@ // Autofix

@@ -30,2 +30,3 @@ import Rule from './_base.js';

'noframes',
'param',
'plaintext',

@@ -32,0 +33,0 @@ 'rb',

@@ -38,3 +38,3 @@ import Rule from './_base.js';

if (this.mode === 'fix') {
newChars[idx] = element.replace(/\s+$/g, '');
newChars[idx] = element.replaceAll(/\s+$/g, '');
} else {

@@ -41,0 +41,0 @@ this.log({

{
"name": "ember-template-lint",
"version": "5.13.0",
"version": "6.0.0-alpha.0",
"description": "Linter for Ember or Handlebars templates.",

@@ -97,7 +97,7 @@ "keywords": [

"@microsoft/jest-sarif": "^1.0.0-beta.0",
"@release-it-plugins/lerna-changelog": "^5.0.0",
"@release-it-plugins/lerna-changelog": "^6.0.0",
"@scalvert/bin-tester": "^2.1.0",
"common-tags": "^1.8.2",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",

@@ -107,13 +107,13 @@ "eslint-plugin-filenames": "^1.3.2",

"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-unicorn": "^46.0.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-unicorn": "^51.0.1",
"execa": "^7.1.0",
"fixturify-project": "^5.2.0",
"jest": "^29.6.2",
"markdownlint-cli": "^0.34.0",
"npm-package-json-lint": "^6.4.0",
"markdownlint-cli": "^0.39.0",
"npm-package-json-lint": "^7.1.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"release-it": "^15.11.0",
"prettier": "^3.2.5",
"release-it": "^17.0.0",
"sort-package-json": "^2.5.1",

@@ -125,7 +125,7 @@ "yeoman-environment": "^3.19.3",

"engines": {
"node": "^14.18.0 || ^16.0.0 || >= 18.0.0"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"volta": {
"node": "18.12.0",
"npm": "8.19.2"
"node": "21.6.2",
"npm": "10.4.0"
},

@@ -132,0 +132,0 @@ "publishConfig": {

@@ -21,3 +21,3 @@ # ember-template-lint

- [Node.js](https://nodejs.org/) `^14.18.0 || ^16.0.0 || >=18.0.0`
- [Node.js](https://nodejs.org/) `^18.18.0 || ^20.9.0 || >=21.1.0`

@@ -107,3 +107,3 @@ ## Installation

| [no-action-modifiers](./docs/rule/no-action-modifiers.md) | | | | |
| [no-action-on-submit-button](./docs/rule/no-action-on-submit-button.md) | | | | |
| [no-action-on-submit-button](./docs/rule/no-action-on-submit-button.md) | ✅ | | | |
| [no-args-paths](./docs/rule/no-args-paths.md) | ✅ | | | |

@@ -114,3 +114,3 @@ | [no-arguments-for-html-elements](./docs/rule/no-arguments-for-html-elements.md) | ✅ | | | |

| [no-array-prototype-extensions](./docs/rule/no-array-prototype-extensions.md) | ✅ | | | 🔧 |
| [no-at-ember-render-modifiers](./docs/rule/no-at-ember-render-modifiers.md) | | | | |
| [no-at-ember-render-modifiers](./docs/rule/no-at-ember-render-modifiers.md) | ✅ | | | |
| [no-attrs-in-components](./docs/rule/no-attrs-in-components.md) | ✅ | | | |

@@ -120,3 +120,3 @@ | [no-autofocus-attribute](./docs/rule/no-autofocus-attribute.md) | ✅ | | ⌨️ | |

| [no-block-params-for-html-elements](./docs/rule/no-block-params-for-html-elements.md) | ✅ | | | |
| [no-builtin-form-components](./docs/rule/no-builtin-form-components.md) | | | | |
| [no-builtin-form-components](./docs/rule/no-builtin-form-components.md) | ✅ | | | |
| [no-capital-arguments](./docs/rule/no-capital-arguments.md) | ✅ | | | |

@@ -181,4 +181,4 @@ | [no-class-bindings](./docs/rule/no-class-bindings.md) | ✅ | | | |

| [no-unnecessary-concat](./docs/rule/no-unnecessary-concat.md) | | 💅 | | 🔧 |
| [no-unnecessary-curly-parens](./docs/rule/no-unnecessary-curly-parens.md) | | | | 🔧 |
| [no-unnecessary-curly-strings](./docs/rule/no-unnecessary-curly-strings.md) | | | | 🔧 |
| [no-unnecessary-curly-parens](./docs/rule/no-unnecessary-curly-parens.md) | ✅ | | | 🔧 |
| [no-unnecessary-curly-strings](./docs/rule/no-unnecessary-curly-strings.md) | ✅ | | | 🔧 |
| [no-unsupported-role-attributes](./docs/rule/no-unsupported-role-attributes.md) | ✅ | | ⌨️ | 🔧 |

@@ -209,3 +209,3 @@ | [no-unused-block-params](./docs/rule/no-unused-block-params.md) | ✅ | | | |

| [self-closing-void-elements](./docs/rule/self-closing-void-elements.md) | | 💅 | | 🔧 |
| [simple-modifiers](./docs/rule/simple-modifiers.md) | | | | |
| [simple-modifiers](./docs/rule/simple-modifiers.md) | ✅ | | | |
| [simple-unless](./docs/rule/simple-unless.md) | ✅ | | | 🔧 |

@@ -212,0 +212,0 @@ | [splat-attributes-only](./docs/rule/splat-attributes-only.md) | ✅ | | | |

Sorry, the diff of this file is too big to display

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