Skip to content

Commit a3750d6

Browse files
committed
lint:fix
1 parent eb3a79e commit a3750d6

61 files changed

Lines changed: 819 additions & 101 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eslint-rules/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* eslint-disable no-undef */
2+
13
'use strict';
24

35
module.exports = {

eslint-rules/no-barrel-imports.js

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-undef */
12
'use strict';
23

34
const fs = require('node:fs');
@@ -32,7 +33,13 @@ function resolveBarrelPath(specifier) {
3233
function resolveImportSource(spec, fromFile) {
3334
if (!spec.startsWith('.')) return resolveBarrelPath(spec);
3435
const base = path.resolve(path.dirname(fromFile), spec);
35-
for (const c of [base, base + '.ts', base + '.js', path.join(base, 'index.ts'), path.join(base, 'index.js')]) {
36+
for (const c of [
37+
base,
38+
base + '.ts',
39+
base + '.js',
40+
path.join(base, 'index.ts'),
41+
path.join(base, 'index.js'),
42+
]) {
3643
if (fs.existsSync(c)) return c;
3744
}
3845
return null;
@@ -75,9 +82,15 @@ function getModuleExports(filepath, stack = new Set()) {
7582
const exports = new Map();
7683
for (const stmt of ast.body) {
7784
if (stmt.type === 'ExportNamedDeclaration') collectNamedExports(stmt, exports, filepath, stack);
78-
else if (stmt.type === 'ExportAllDeclaration') collectStarExports(stmt, exports, filepath, stack);
85+
else if (stmt.type === 'ExportAllDeclaration')
86+
collectStarExports(stmt, exports, filepath, stack);
7987
else if (stmt.type === 'ExportDefaultDeclaration') {
80-
exports.set('default', { source: filepath, localName: 'default', isType: false, kind: 'local' });
88+
exports.set('default', {
89+
source: filepath,
90+
localName: 'default',
91+
isType: false,
92+
kind: 'local',
93+
});
8194
}
8295
}
8396

@@ -91,7 +104,12 @@ function collectNamedExports(stmt, exports, filepath, stack) {
91104

92105
if (stmt.declaration) {
93106
for (const { name, isType } of declarationNames(stmt.declaration)) {
94-
exports.set(name, { source: filepath, localName: name, isType: isType || stmtIsType, kind: 'local' });
107+
exports.set(name, {
108+
source: filepath,
109+
localName: name,
110+
isType: isType || stmtIsType,
111+
kind: 'local',
112+
});
95113
}
96114
return;
97115
}
@@ -134,7 +152,13 @@ function collectNamedExports(stmt, exports, filepath, stack) {
134152
}
135153
}
136154

137-
exports.set(idOrStr(spec.exported), { source, bareSource, localName: local, isType, kind: 'named' });
155+
exports.set(idOrStr(spec.exported), {
156+
source,
157+
bareSource,
158+
localName: local,
159+
isType,
160+
kind: 'named',
161+
});
138162
}
139163
}
140164

@@ -163,14 +187,11 @@ const SCOPE_PREFIXES = [
163187
path.join(PACKAGES_ROOT, '@ember') + path.sep,
164188
path.join(PACKAGES_ROOT, '@glimmer') + path.sep,
165189
];
166-
const EXCLUDED_FILE_PREFIXES = [
167-
path.join(PACKAGES_ROOT, '@glimmer/component') + path.sep,
168-
];
190+
const EXCLUDED_FILE_PREFIXES = [path.join(PACKAGES_ROOT, '@glimmer/component') + path.sep];
169191
const TEST_DIR_RE = /[\\/](?:test|tests)[\\/]/;
170192

171193
const isInScope = (filename) => SCOPE_PREFIXES.some((p) => filename.startsWith(p));
172-
const isExcludedFile = (filename) =>
173-
EXCLUDED_FILE_PREFIXES.some((p) => filename.startsWith(p));
194+
const isExcludedFile = (filename) => EXCLUDED_FILE_PREFIXES.some((p) => filename.startsWith(p));
174195
const isInTestFile = (filename) =>
175196
TEST_DIR_RE.test(filename) || filename.includes(`${path.sep}internal-test-helpers${path.sep}`);
176197

@@ -211,9 +232,7 @@ function packageHasWildcardSourceExports(packageRoot) {
211232
const matches = (v) => v === './*.ts';
212233
allowed =
213234
matches(wildcard) ||
214-
(wildcard &&
215-
typeof wildcard === 'object' &&
216-
Object.values(wildcard).some(matches));
235+
(wildcard && typeof wildcard === 'object' && Object.values(wildcard).some(matches));
217236
} catch {
218237
/* ignore */
219238
}
@@ -384,8 +403,10 @@ module.exports = {
384403
return;
385404
}
386405

387-
if (node.type === 'ImportDeclaration') return handleImport(node, moduleExports, spec, barrelPath);
388-
if (node.type === 'ExportNamedDeclaration') return handleExportNamed(node, moduleExports, spec, barrelPath);
406+
if (node.type === 'ImportDeclaration')
407+
return handleImport(node, moduleExports, spec, barrelPath);
408+
if (node.type === 'ExportNamedDeclaration')
409+
return handleExportNamed(node, moduleExports, spec, barrelPath);
389410
if (node.type === 'ExportAllDeclaration') reportUnresolved(node, spec, ['*']);
390411
}
391412

@@ -404,9 +425,11 @@ module.exports = {
404425
continue;
405426
}
406427
const importedName =
407-
sp.type === 'ImportDefaultSpecifier' ? 'default'
408-
: sp.type === 'ImportSpecifier' ? idOrStr(sp.imported)
409-
: null;
428+
sp.type === 'ImportDefaultSpecifier'
429+
? 'default'
430+
: sp.type === 'ImportSpecifier'
431+
? idOrStr(sp.imported)
432+
: null;
410433
if (importedName === null) continue;
411434

412435
const local = sp.local.name;

eslint.config.mjs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,10 +521,7 @@ export default [
521521
},
522522
{
523523
files: ['packages/@ember/**/*.{ts,js}', 'packages/@glimmer/**/*.{ts,js}'],
524-
ignores: [
525-
'packages/@ember/**/tests/**',
526-
'packages/@glimmer/**/test/**',
527-
],
524+
ignores: ['packages/@ember/**/tests/**', 'packages/@glimmer/**/test/**'],
528525
rules: {
529526
'ember-local/no-barrel-imports': 'error',
530527
},

packages/@ember/-internals/glimmer/lib/component-managers/curly.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import {
55
setOwner,
66
} from '@ember/-internals/owner';
77
import { guidFor } from '@ember/-internals/utils/lib/guid';
8-
import { addChildView, setElementView, setViewElement } from '@ember/-internals/views/lib/system/utils';
8+
import {
9+
addChildView,
10+
setElementView,
11+
setViewElement,
12+
} from '@ember/-internals/views/lib/system/utils';
913
import type { Nullable } from '@ember/-internals/utility-types';
1014
import { assert, debugFreeze } from '@ember/debug';
1115
import { _instrumentStart } from '@ember/instrumentation';
@@ -26,11 +30,22 @@ import type {
2630
WithDynamicTagName,
2731
} from '@glimmer/interfaces';
2832
import type { Reference } from '@glimmer/reference/lib/reference';
29-
import { childRefFor, createComputeRef, createPrimitiveRef, valueForRef } from '@glimmer/reference/lib/reference';
33+
import {
34+
childRefFor,
35+
createComputeRef,
36+
createPrimitiveRef,
37+
valueForRef,
38+
} from '@glimmer/reference/lib/reference';
3039
import { reifyPositional } from '@glimmer/runtime/lib/vm/arguments';
3140
import { EMPTY_ARRAY } from '@glimmer/util/lib/array-utils';
3241
import { unwrapTemplate } from './unwrap-template';
33-
import { beginTrackFrame, beginUntrackFrame, consumeTag, endTrackFrame, endUntrackFrame } from '@glimmer/validator/lib/tracking';
42+
import {
43+
beginTrackFrame,
44+
beginUntrackFrame,
45+
consumeTag,
46+
endTrackFrame,
47+
endUntrackFrame,
48+
} from '@glimmer/validator/lib/tracking';
3449
import { validateTag, valueForTag } from '@glimmer/validator/lib/validators';
3550
import type Component from '../component';
3651
import type { DynamicScope } from '../renderer';

packages/@ember/-internals/glimmer/lib/component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import { getOwner } from '@ember/-internals/owner';
77
import TargetActionSupport from '@ember/-internals/runtime/lib/mixins/target_action_support';
88
import type ViewStates from '@ember/-internals/views/lib/views/states';
99
import ActionSupport from '@ember/-internals/views/lib/mixins/action_support';
10-
import { addChildView, getChildViews, getViewElement } from '@ember/-internals/views/lib/system/utils';
10+
import {
11+
addChildView,
12+
getChildViews,
13+
getViewElement,
14+
} from '@ember/-internals/views/lib/system/utils';
1115
import CoreView from '@ember/-internals/views/lib/views/core_view';
1216
import EventDispatcher from '@ember/-internals/views/lib/system/event_dispatcher';
1317
import { guidFor } from '@ember/-internals/utils/lib/guid';

packages/@ember/-internals/glimmer/lib/components/abstract-input.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { tracked } from '@ember/-internals/metal/lib/tracked';
22
import { assert } from '@ember/debug';
33
import { action } from '@ember/object';
44
import type { Reference } from '@glimmer/reference/lib/reference';
5-
import { isConstRef, isUpdatableRef, updateRef, valueForRef } from '@glimmer/reference/lib/reference';
5+
import {
6+
isConstRef,
7+
isUpdatableRef,
8+
updateRef,
9+
valueForRef,
10+
} from '@glimmer/reference/lib/reference';
611
import type { EventListener } from './internal';
712
import InternalComponent from './internal';
813

packages/@ember/-internals/glimmer/lib/resolver.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ import type {
1313
} from '@glimmer/interfaces';
1414
import type { Nullable } from '@ember/-internals/utility-types';
1515
import { getComponentTemplate } from '@glimmer/manager/lib/public/template';
16-
import { getInternalComponentManager, setInternalHelperManager } from '@glimmer/manager/lib/internal/api';
16+
import {
17+
getInternalComponentManager,
18+
setInternalHelperManager,
19+
} from '@glimmer/manager/lib/internal/api';
1720
import { array } from '@glimmer/runtime/lib/helpers/array';
1821
import { concat } from '@glimmer/runtime/lib/helpers/concat';
1922
import { fn } from '@glimmer/runtime/lib/helpers/fn';
2023
import { get } from '@glimmer/runtime/lib/helpers/get';
2124
import { hash } from '@glimmer/runtime/lib/helpers/hash';
2225
import { on } from '@glimmer/runtime/lib/modifiers/on';
23-
import { templateOnlyComponent, TEMPLATE_ONLY_COMPONENT_MANAGER } from '@glimmer/runtime/lib/component/template-only';
26+
import {
27+
templateOnlyComponent,
28+
TEMPLATE_ONLY_COMPONENT_MANAGER,
29+
} from '@glimmer/runtime/lib/component/template-only';
2430
import { isCurlyManager } from './component-managers/curly';
2531
import { CLASSIC_HELPER_MANAGER, isClassicHelper } from './helper';
2632
import { default as disallowDynamicResolution } from './helpers/-disallow-dynamic-resolution';

packages/@ember/-internals/glimmer/lib/syntax/outlet.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ import type {
88
Template,
99
} from '@glimmer/interfaces';
1010
import type { Reference } from '@glimmer/reference/lib/reference';
11-
import { childRefFromParts, createComputeRef, createConstRef, createDebugAliasRef, valueForRef } from '@glimmer/reference/lib/reference';
11+
import {
12+
childRefFromParts,
13+
createComputeRef,
14+
createConstRef,
15+
createDebugAliasRef,
16+
valueForRef,
17+
} from '@glimmer/reference/lib/reference';
1218
import type { CurriedValue } from '@glimmer/runtime/lib/curried-value';
1319
import { createCapturedArgs, EMPTY_POSITIONAL } from '@glimmer/runtime/lib/vm/arguments';
1420
import { curry } from '@glimmer/runtime/lib/curried-value';

packages/@ember/-internals/glimmer/lib/utils/bindings.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import { assert } from '@ember/debug';
33
import { dasherize } from '@ember/-internals/string';
44
import type { ElementOperations } from '@glimmer/interfaces';
55
import type { Reference } from '@glimmer/reference/lib/reference';
6-
import { childRefFor, childRefFromParts, createComputeRef, createPrimitiveRef, valueForRef } from '@glimmer/reference/lib/reference';
6+
import {
7+
childRefFor,
8+
childRefFromParts,
9+
createComputeRef,
10+
createPrimitiveRef,
11+
valueForRef,
12+
} from '@glimmer/reference/lib/reference';
713
import type Component from '../component';
814

915
function referenceForParts(rootRef: Reference<Component>, parts: string[]): Reference {

packages/@ember/-internals/glimmer/lib/utils/curly-component-state-bucket.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { clearElementView, clearViewElement, getViewElement } from '@ember/-internals/views/lib/system/utils';
1+
import {
2+
clearElementView,
3+
clearViewElement,
4+
getViewElement,
5+
} from '@ember/-internals/views/lib/system/utils';
26
import { registerDestructor } from '@glimmer/destroyable';
37
import type { CapturedNamedArguments } from '@glimmer/interfaces';
48
import type { Reference } from '@glimmer/reference/lib/reference';

0 commit comments

Comments
 (0)