Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the prettier organize imports plugin #1507

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"printWidth": 100,
"plugins": [],
"plugins": ["prettier-plugin-organize-imports"],
"overrides": [
{
"files": ["**/*.{js,ts,cjs,mjs,cts,mts,cts}"],
Expand Down
2 changes: 0 additions & 2 deletions bin/opcodes.mts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { dirname, resolve } from 'node:path';
import chalk from 'chalk';
import { execSync, spawnSync } from 'node:child_process';
import { Emitter } from './opcodes/utils.mjs';

const emitter = Emitter.argv('opcodes.json', import.meta);
Expand Down
4 changes: 2 additions & 2 deletions bin/opcodes/utils.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
import { dirname, relative, resolve } from 'node:path';
import chalk from 'chalk';
import { spawnSync } from 'node:child_process';
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
import { dirname, relative, resolve } from 'node:path';

const MISSING_INDEX = -1;
const REMOVE = 1;
Expand Down
2 changes: 1 addition & 1 deletion bin/update-package-json.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { resolve } from 'node:path';

import chalk from 'chalk';

import { type Package, packages } from './packages.mjs';
import { packages, type Package } from './packages.mjs';

const ROLLUP_CONFIG = [
`import { Package } from '@glimmer-workspace/build-support'`,
Expand Down
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
"name": "glimmer-engine",
"version": "0.85.13",
"private": true,
"license": "MIT",
"description": "Glimmer compiles Handlebars templates into document fragments rather than string buffers",
"repository": {
"type": "git",
"url": "https://github.com/glimmerjs/glimmer-vm.git"
},
"license": "MIT",
"author": "Tilde, Inc.",
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"scripts": {
"clean": "node ./bin/clean.mjs",
"benchmark:build": "node benchmark/bin/build.js",
"benchmark:control": "node benchmark/bin/control.js",
"benchmark:experiment": "node benchmark/bin/experiment.js",
Expand All @@ -20,34 +22,35 @@
"build": "dotenv -- turbo build",
"build:control": "rollup -c rollup.config.mjs",
"build:flags": "RETAIN_FLAGS=true ember build --env production --suppress-sizes",
"clean": "node ./bin/clean.mjs",
"lint": "npm-run-all lint:*",
"lint:format": "prettier -c .",
"lint:files": "turbo lint",
"lint:format": "prettier -c .",
"lint:types": "tsc -b",
"lintfix": "pnpm turbo test:lint -- --fix && prettier -w .",
"start": "ember serve --port=7357",
"test": "node bin/run-tests.mjs",
"test:babel-plugins": "yarn workspace @glimmer/vm-babel-plugins test",
"test:browserstack": "ember test --test-port=7774 --host 127.0.0.1 --config-file=testem-browserstack.js",
"test:node": "node bin/run-node-tests.mjs",
"test:babel-plugins": "yarn workspace @glimmer/vm-babel-plugins test",
"test:smoke": "SMOKE_TESTS=true ember test",
"test:types": "node bin/run-types-tests.mjs"
},
"pnpm": {
"overrides": {
"typescript": "$typescript",
"@rollup/pluginutils": "^5.0.2",
"@types/node": "$@types/node"
"@types/node": "$@types/node",
"typescript": "$typescript"
},
"patchedDependencies": {
"@release-it-plugins/workspaces@4.0.0": "patches/@release-it-plugins__workspaces@4.0.0.patch"
},
"peerDependencyRules": {
"allowedVersions": {
"typescript": "5",
"@rollup/pluginutils": "5",
"rollup": "3"
"rollup": "3",
"typescript": "5"
}
},
"patchedDependencies": {
"@release-it-plugins/workspaces@4.0.0": "patches/@release-it-plugins__workspaces@4.0.0.patch"
}
},
"devDependencies": {
Expand Down Expand Up @@ -102,6 +105,7 @@
"mkdirp": "^3.0.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.0",
"prettier-plugin-organize-imports": "^3.2.4",
"preval.macro": "^5.0.0",
"puppeteer": "^20.1.2",
"puppeteer-chromium-resolver": "^20.0.0",
Expand All @@ -118,9 +122,6 @@
"vite": "^4.3.9",
"xo": "^0.54.2"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"release-it": {
"plugins": {
"@release-it-plugins/workspaces": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Dict, Owner, Template, VMArguments, WithCreateInstance } from '@glimmer/interfaces';
import type { Reference } from '@glimmer/reference';
import { getComponentTemplate } from '@glimmer/manager';
import type { Reference } from '@glimmer/reference';
import { createConstRef } from '@glimmer/reference';
import { EMPTY_ARGS } from '@glimmer/runtime';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable no-console */

import setGlobalContext from '@glimmer/global-context';
import type { Destroyable, Destructor, RenderResult } from '@glimmer/interfaces';
import type { EnvironmentDelegate } from '@glimmer/runtime';
import setGlobalContext from '@glimmer/global-context';

type Queue = (() => void)[];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
setInternalModifierManager,
} from '@glimmer/manager';
import { programCompilationContext } from '@glimmer/opcode-compiler';
import { artifacts, RuntimeOpImpl } from '@glimmer/program';
import { RuntimeOpImpl, artifacts } from '@glimmer/program';

import type { UpdateBenchmark } from '../interfaces';

Expand Down
2 changes: 1 addition & 1 deletion packages/@glimmer-workspace/build/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export class Package {
typescript(this.#package, {
target: ScriptTarget.ES2021,
module: ModuleKind.CommonJS,
moduleResolution: ModuleResolutionKind.NodeJs,
moduleResolution: ModuleResolutionKind.Node10,
}),
],
}));
Expand Down
2 changes: 1 addition & 1 deletion packages/@glimmer-workspace/integration-tests/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import './lib/setup';

export { syntaxErrorFor } from '@glimmer-workspace/test-utils';
export * from './lib/base-env';
export * from './lib/compile';
export * from './lib/components';
Expand All @@ -25,4 +26,3 @@ export * from './lib/test-helpers/strings';
export * from './lib/test-helpers/test';
export * from './lib/test-helpers/tracked';
export * from './lib/test-helpers/tracked-object';
export { syntaxErrorFor } from '@glimmer-workspace/test-utils';
4 changes: 2 additions & 2 deletions packages/@glimmer-workspace/integration-tests/lib/compile.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { precompileJSON } from '@glimmer/compiler';
import type {
Nullable,
SerializedTemplateWithLazyBlock,
Template,
TemplateFactory,
} from '@glimmer/interfaces';
import type { PrecompileOptions } from '@glimmer/syntax';
import { precompileJSON } from '@glimmer/compiler';
import { templateFactory } from '@glimmer/opcode-compiler';
import type { PrecompileOptions } from '@glimmer/syntax';

// TODO: This fundamentally has little to do with testing and
// most tests should just use a more generic preprocess, extracted
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { registerDestructor } from '@glimmer/destroyable';
import type {
Bounds,
CapturedNamedArguments,
Expand All @@ -18,8 +19,6 @@ import type {
WithDynamicLayout,
WithDynamicTagName,
} from '@glimmer/interfaces';
import type { DirtyableTag } from '@glimmer/validator';
import { registerDestructor } from '@glimmer/destroyable';
import { setInternalComponentManager } from '@glimmer/manager';
import {
childRefFor,
Expand All @@ -29,7 +28,8 @@ import {
valueForRef,
} from '@glimmer/reference';
import { reifyNamed, reifyPositional } from '@glimmer/runtime';
import { assign, EMPTY_ARRAY, keys, unwrapTemplate } from '@glimmer/util';
import { EMPTY_ARRAY, assign, keys, unwrapTemplate } from '@glimmer/util';
import type { DirtyableTag } from '@glimmer/validator';
import { consumeTag, createTag, dirtyTag, dirtyTagFor } from '@glimmer/validator';

import type { TestJitRuntimeResolver } from '../modes/jit/resolver';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Arguments, ComponentManager, Dict, Owner } from '@glimmer/interfaces';
import { destroy, isDestroyed, isDestroying, registerDestructor } from '@glimmer/destroyable';
import type { Arguments, ComponentManager, Dict, Owner } from '@glimmer/interfaces';
import { componentCapabilities, setComponentManager } from '@glimmer/manager';
import { setOwner } from '@glimmer/owner';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
SimpleText,
} from '@glimmer/interfaces';
import type { COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, TEXT_NODE } from '@glimmer/util';
import { clearElement, ELEMENT_NODE, INSERT_AFTER_BEGIN } from '@glimmer/util';
import { ELEMENT_NODE, INSERT_AFTER_BEGIN, clearElement } from '@glimmer/util';
import Serializer from '@simple-dom/serializer';
import voidMap from '@simple-dom/void-map';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ import type {
SimpleElement,
SimpleText,
} from '@glimmer/interfaces';
import type { Reference } from '@glimmer/reference';
import type { CurriedValue, EnvironmentDelegate } from '@glimmer/runtime';
import type { ASTPluginBuilder, PrecompileOptions } from '@glimmer/syntax';
import { programCompilationContext } from '@glimmer/opcode-compiler';
import { artifacts, RuntimeOpImpl } from '@glimmer/program';
import { RuntimeOpImpl, artifacts } from '@glimmer/program';
import type { Reference } from '@glimmer/reference';
import { createConstRef } from '@glimmer/reference';
import type { CurriedValue, EnvironmentDelegate } from '@glimmer/runtime';
import {
array,
clientBuilder,
Expand All @@ -35,6 +34,7 @@ import {
renderSync,
runtimeContext,
} from '@glimmer/runtime';
import type { ASTPluginBuilder, PrecompileOptions } from '@glimmer/syntax';
import { assign, castToBrowser, castToSimple, expect, unwrapTemplate } from '@glimmer/util';

import type { ComponentKind, ComponentTypes } from '../../components';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import type {
ResolutionTimeConstants,
TemplateFactory,
} from '@glimmer/interfaces';
import type { CurriedValue } from '@glimmer/runtime';
import {
getInternalComponentManager,
setComponentTemplate,
setInternalHelperManager,
setInternalModifierManager,
} from '@glimmer/manager';
import type { CurriedValue } from '@glimmer/runtime';
import { curry, templateOnlyComponent } from '@glimmer/runtime';
import { CurriedTypes } from '@glimmer/vm';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ElementBuilder, RenderResult } from '@glimmer/interfaces';
import type { Reference } from '@glimmer/reference';
import type { PrecompileOptions } from '@glimmer/syntax';
import { renderMain, renderSync } from '@glimmer/runtime';
import type { PrecompileOptions } from '@glimmer/syntax';
import { unwrapTemplate } from '@glimmer/util';

import type { JitTestDelegateContext } from './delegate';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import type {
SimpleNode,
SimpleText,
} from '@glimmer/interfaces';
import type { Reference } from '@glimmer/reference';
import type { ASTPluginBuilder, PrecompileOptions } from '@glimmer/syntax';
import { serializeBuilder } from '@glimmer/node';
import type { Reference } from '@glimmer/reference';
import { createConstRef } from '@glimmer/reference';
import type { ASTPluginBuilder, PrecompileOptions } from '@glimmer/syntax';
import { assign, castToSimple } from '@glimmer/util';
import createHTMLDocument from '@simple-dom/document';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { registerDestructor } from '@glimmer/destroyable';
import type {
CapturedArguments,
Destroyable,
Expand All @@ -7,9 +8,8 @@ import type {
Owner,
SimpleElement,
} from '@glimmer/interfaces';
import type { UpdatableTag } from '@glimmer/validator';
import { registerDestructor } from '@glimmer/destroyable';
import { reifyNamed, reifyPositional } from '@glimmer/runtime';
import type { UpdatableTag } from '@glimmer/validator';
import { createUpdatableTag } from '@glimmer/validator';

export interface TestModifierConstructor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { NTuple } from '@glimmer-workspace/test-utils';
import { destroy } from '@glimmer/destroyable';
import type {
ComponentDefinitionState,
Dict,
Expand All @@ -9,10 +11,8 @@ import type {
SimpleElement,
SimpleNode,
} from '@glimmer/interfaces';
import type { ASTPluginBuilder } from '@glimmer/syntax';
import type { NTuple } from '@glimmer-workspace/test-utils';
import { destroy } from '@glimmer/destroyable';
import { inTransaction } from '@glimmer/runtime';
import type { ASTPluginBuilder } from '@glimmer/syntax';
import { assert, clearElement, dict, expect, isPresent, unwrap } from '@glimmer/util';
import { dirtyTagFor } from '@glimmer/validator';

Expand Down
4 changes: 2 additions & 2 deletions packages/@glimmer-workspace/integration-tests/lib/setup.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import setGlobalContext from '@glimmer/global-context';
import type { Destroyable, Destructor, Dict, Nullable } from '@glimmer/interfaces';
import type { IteratorDelegate } from '@glimmer/reference';
import type { TestBase } from 'qunit';
import setGlobalContext from '@glimmer/global-context';
import { consumeTag, dirtyTagFor, tagFor } from '@glimmer/validator';
import type { TestBase } from 'qunit';

import { scheduleDidDestroy, scheduleWillDestroy } from './base-env';
import { NativeIteratorDelegate } from './modes/env';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Nullable, SimpleElement, SimpleNode } from '@glimmer/interfaces';
import { COMMENT_NODE, TEXT_NODE, castToSimple, unwrap } from '@glimmer/util';
import type { EndTag, Token } from 'simple-html-tokenizer';
import { castToSimple, COMMENT_NODE, TEXT_NODE, unwrap } from '@glimmer/util';
import { tokenize } from 'simple-html-tokenizer';

import { replaceHTML, toInnerHTML } from './dom/simple-utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Cursor, ElementBuilder, Environment } from '@glimmer/interfaces';
import { precompile } from '@glimmer/compiler';
import type { Cursor, ElementBuilder, Environment } from '@glimmer/interfaces';
import { NodeDOMTreeConstruction, serializeBuilder } from '@glimmer/node';

import { blockStack } from '../dom/blocks';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AST } from '@glimmer/syntax';
import { destroy } from '@glimmer/destroyable';
import type { AST } from '@glimmer/syntax';
import { assign, unwrap } from '@glimmer/util';

import { GlimmerishComponent } from '../components/emberish-glimmer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { registerDestructor } from '@glimmer/destroyable';
import type {
Arguments,
HelperCapabilities,
HelperManager,
ModifierManager,
Owner,
} from '@glimmer/interfaces';
import { registerDestructor } from '@glimmer/destroyable';
import {
helperCapabilities,
modifierCapabilities,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { precompile } from '@glimmer/compiler';
import type { WireFormat } from '@glimmer/interfaces';
import type { TemplateWithIdAndReferrer } from '@glimmer/opcode-compiler';
import { precompile } from '@glimmer/compiler';
import { assert as glimmerAssert, unwrapTemplate } from '@glimmer/util';
import { SexpOpcodes } from '@glimmer/wire-format';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type {
SimpleElement,
SimpleNode,
} from '@glimmer/interfaces';
import type { TemplateOnlyComponent } from '@glimmer/runtime';
import { setComponentTemplate } from '@glimmer/manager';
import type { TemplateOnlyComponent } from '@glimmer/runtime';
import { EMPTY_ARGS, templateOnlyComponent, TemplateOnlyComponentManager } from '@glimmer/runtime';
import { assign, expect } from '@glimmer/util';

Expand Down
Loading
Loading