Skip to content

Commit 51ff450

Browse files
NullVoxPopuliclaude
andcommitted
Fix self-lint errors
- Reorder regex char class per unicorn/better-regex - Use for-of loop per unicorn/no-for-loop - Move initHbsESLint to outer scope per unicorn/consistent-function-scoping - Disable import/no-unresolved for ember-eslint-parser/hbs (valid export) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent ed81226 commit 51ff450

3 files changed

Lines changed: 30 additions & 30 deletions

File tree

lib/config/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const plugin = require('../index');
22
const emberEslintParser = require('ember-eslint-parser');
3-
const emberEslintParserHbs = require('ember-eslint-parser/hbs');
3+
const emberEslintParserHbs = require('ember-eslint-parser/hbs'); // eslint-disable-line import/no-unresolved
44

55
module.exports = [
66
{

lib/processors/template-lint-disable.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ const noop = require('ember-eslint-parser/noop');
99
* {{!-- template-lint-disable rule1 rule2 --}}
1010
*/
1111
const MUSTACHE_COMMENT_REGEX =
12-
/{{!\s+template-lint-disable([\w\s,/-]*)}}/g;
12+
/{{!\s+template-lint-disable([\s\w,/-]*)}}/g;
1313
const MUSTACHE_BLOCK_COMMENT_REGEX =
14-
/{{!--\s*template-lint-disable([\w\s,/-]*)--}}/g;
14+
/{{!--\s*template-lint-disable([\s\w,/-]*)--}}/g;
1515

1616
// Store disable directives per file
1717
const fileDisableDirectives = new Map();
@@ -50,8 +50,8 @@ function parseDisableDirectives(text) {
5050
const directives = [];
5151
const lines = text.split('\n');
5252

53-
for (let i = 0; i < lines.length; i++) {
54-
collectMatches(lines[i], i, directives);
53+
for (const [i, line] of lines.entries()) {
54+
collectMatches(line, i, directives);
5555
}
5656

5757
return directives;

tests/lib/rules-preprocessor/gjs-gts-parser-test.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,33 +1022,33 @@ describe('supports template-lint-disable directive', () => {
10221022
});
10231023
});
10241024

1025-
describe('supports template-lint-disable directive in hbs files', () => {
1026-
function initHbsESLint() {
1027-
return new ESLint({
1028-
ignore: false,
1029-
useEslintrc: false,
1030-
plugins: { ember: plugin },
1031-
overrideConfig: {
1032-
root: true,
1033-
parserOptions: {
1034-
ecmaVersion: 2022,
1035-
sourceType: 'module',
1036-
},
1037-
plugins: ['ember'],
1038-
overrides: [
1039-
{
1040-
files: ['**/*.hbs'],
1041-
parser: hbsParser,
1042-
processor: 'ember/noop',
1043-
rules: {
1044-
'ember/template-no-bare-strings': 'error',
1045-
},
1046-
},
1047-
],
1025+
function initHbsESLint() {
1026+
return new ESLint({
1027+
ignore: false,
1028+
useEslintrc: false,
1029+
plugins: { ember: plugin },
1030+
overrideConfig: {
1031+
root: true,
1032+
parserOptions: {
1033+
ecmaVersion: 2022,
1034+
sourceType: 'module',
10481035
},
1049-
});
1050-
}
1036+
plugins: ['ember'],
1037+
overrides: [
1038+
{
1039+
files: ['**/*.hbs'],
1040+
parser: hbsParser,
1041+
processor: 'ember/noop',
1042+
rules: {
1043+
'ember/template-no-bare-strings': 'error',
1044+
},
1045+
},
1046+
],
1047+
},
1048+
});
1049+
}
10511050

1051+
describe('supports template-lint-disable directive in hbs files', () => {
10521052
it('disables all rules on the next line with mustache comment', async () => {
10531053
const eslint = initHbsESLint();
10541054
const code = `<div>

0 commit comments

Comments
 (0)