Skip to content

Commit

Permalink
Enforce importsNotUsedAsValues:'error'
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Apr 8, 2022
1 parent 92e5cb9 commit d77ca6a
Show file tree
Hide file tree
Showing 54 changed files with 168 additions and 188 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/inspect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CLITable from 'cli-table3';
import { stringify } from 'csv-stringify';
import { JSONDocument, Logger, NodeIO, WebIO } from '@gltf-transform/core';
import type { JSONDocument, Logger, NodeIO, WebIO } from '@gltf-transform/core';
import {
InspectAnimationReport,
InspectMaterialReport,
Expand All @@ -11,7 +11,7 @@ import {
inspect as inspectDoc,
} from '@gltf-transform/functions';
import { formatBytes, formatHeader, formatLong, formatParagraph, formatXMP } from './util';
import { Packet } from '@gltf-transform/extensions';
import type { Packet } from '@gltf-transform/extensions';

export enum InspectFormat {
PRETTY = 'pretty',
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/session.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Document, NodeIO, Logger, FileUtils, Transform } from '@gltf-transform/core';
import { Packet, XMP } from '@gltf-transform/extensions';
import type { Packet, XMP } from '@gltf-transform/extensions';
import { formatBytes, XMPContext } from './util';

/** Helper class for managing a CLI command session. */
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/transforms/ktxfix.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const micromatch = require('micromatch');

import { KTX2Primaries, read, write } from 'ktx-parse';
import { Document, Transform } from '@gltf-transform/core';
import type { Document, Transform } from '@gltf-transform/core';
import { MICROMATCH_OPTIONS } from '../util';
import { listTextureSlots } from '@gltf-transform/functions';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/transforms/xmp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Document, Logger, Transform } from '@gltf-transform/core';
import type { Document, Logger, Transform } from '@gltf-transform/core';
import { Packet, XMP } from '@gltf-transform/extensions';
import inquirer from 'inquirer';
import { check as validateLanguage } from 'language-tags';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs';
import path from 'path';
import CLITable from 'cli-table3';
import type Validator from 'gltf-validator';
import { Logger } from '@gltf-transform/core';
import type { Logger } from '@gltf-transform/core';
import { formatHeader } from './util';

const validator = createValidator();
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"compilerOptions": {
"outDir": "dist",
"strict": true
"strict": true,
"importsNotUsedAsValues": "error",
}
}
2 changes: 1 addition & 1 deletion packages/core/src/document.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PropertyType } from './constants';
import { Extension } from './extension';
import type { Extension } from './extension';
import { Graph } from 'property-graph';
import {
Accessor,
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GraphEdgeEvent, GraphEvent, GraphNodeEvent } from 'property-graph';
import { PropertyType } from './constants';
import { Document } from './document';
import { ReaderContext, WriterContext } from './io';
import type { GraphEdgeEvent, GraphEvent, GraphNodeEvent } from 'property-graph';
import type { PropertyType } from './constants';
import type { Document } from './document';
import type { ReaderContext, WriterContext } from './io';
import { ExtensionProperty } from './properties';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/io/node-io.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Format } from '../constants';
import { Document } from '../document';
import type { Document } from '../document';
import { FileUtils } from '../utils/';
import { PlatformIO } from './platform-io';
import { HTTPUtils } from '../utils';
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/io/platform-io.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Format, GLB_BUFFER, VertexLayout } from '../constants';
import { Document } from '../document';
import { Extension } from '../extension';
import { JSONDocument } from '../json-document';
import { GLTF } from '../types/gltf';
import type { Document } from '../document';
import type { Extension } from '../extension';
import type { JSONDocument } from '../json-document';
import type { GLTF } from '../types/gltf';
import { BufferUtils, FileUtils, HTTPUtils, Logger, uuid } from '../utils/';
import { GLTFReader } from './reader';
import { GLTFWriter, WriterOptions } from './writer';
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/io/reader-context.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { JSONDocument } from '../json-document';
import {
import type { JSONDocument } from '../json-document';
import type {
Accessor,
Animation,
Buffer,
Expand All @@ -12,7 +12,7 @@ import {
Texture,
TextureInfo,
} from '../properties';
import { GLTF } from '../types/gltf';
import type { GLTF } from '../types/gltf';

/**
* Model class providing glTF-Transform objects representing each definition in the glTF file, used
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/io/reader.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { GLB_BUFFER, PropertyType, TypedArray, mat4, vec3, vec4 } from '../constants';
import { Document } from '../document';
import { Extension } from '../extension';
import { JSONDocument } from '../json-document';
import type { Extension } from '../extension';
import type { JSONDocument } from '../json-document';
import { Accessor, AnimationSampler, Camera } from '../properties';
import { GLTF } from '../types/gltf';
import type { GLTF } from '../types/gltf';
import { BufferUtils, FileUtils, ImageUtils, Logger, MathUtils } from '../utils';
import { ReaderContext } from './reader-context';

Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/io/writer-context.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BufferViewUsage, Format, PropertyType } from '../constants';
import { Document } from '../document';
import { JSONDocument } from '../json-document';
import {
import type { Document } from '../document';
import type { JSONDocument } from '../json-document';
import type {
Accessor,
Animation,
Buffer,
Expand All @@ -15,9 +15,9 @@ import {
Texture,
TextureInfo,
} from '../properties';
import { GLTF } from '../types/gltf';
import type { GLTF } from '../types/gltf';
import { ImageUtils, Logger } from '../utils';
import { WriterOptions } from './writer';
import type { WriterOptions } from './writer';

type PropertyDef = GLTF.IScene | GLTF.INode | GLTF.IMaterial | GLTF.ISkin | GLTF.ITexture;

Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/io/writer.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Format, GLB_BUFFER, PropertyType, VERSION, VertexLayout } from '../constants';
import { Document } from '../document';
import { Extension } from '../extension';
import { GraphEdge } from 'property-graph';
import { JSONDocument } from '../json-document';
import type { Document } from '../document';
import type { Extension } from '../extension';
import type { GraphEdge } from 'property-graph';
import type { JSONDocument } from '../json-document';
import { Accessor, AnimationSampler, Camera, Material, Property } from '../properties';
import { GLTF } from '../types/gltf';
import type { GLTF } from '../types/gltf';
import { BufferUtils, Logger, MathUtils } from '../utils';
import { WriterContext } from './writer-context';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/json-document.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GLTF } from './types/gltf';
import type { GLTF } from './types/gltf';

/**
* # JSONDocument
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/properties/accessor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Nullable, PropertyType, TypedArray } from '../constants';
import { GLTF } from '../types/gltf';
import type { GLTF } from '../types/gltf';
import { MathUtils } from '../utils';
import { Buffer } from './buffer';
import type { Buffer } from './buffer';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';
import { COPY_IDENTITY } from './property';

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/properties/animation-channel.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Nullable, PropertyType } from '../constants';
import { GLTF } from '../types/gltf';
import { AnimationSampler } from './animation-sampler';
import type { GLTF } from '../types/gltf';
import type { AnimationSampler } from './animation-sampler';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';
import { Node } from './node';
import type { Node } from './node';

interface IAnimationChannel extends IExtensibleProperty {
targetPath: GLTF.AnimationChannelTargetPath | null;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/properties/animation-sampler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BufferViewUsage, Nullable, PropertyType } from '../constants';
import { GLTF } from '../types/gltf';
import { Accessor } from './accessor';
import type { GLTF } from '../types/gltf';
import type { Accessor } from './accessor';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';

interface IAnimationSampler extends IExtensibleProperty {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/properties/animation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Nullable, PropertyType } from '../constants';
import { AnimationChannel } from './animation-channel';
import { AnimationSampler } from './animation-sampler';
import type { AnimationChannel } from './animation-channel';
import type { AnimationSampler } from './animation-sampler';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';

interface IAnimation extends IExtensibleProperty {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/properties/camera.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Nullable, PropertyType } from '../constants';
import { GLTF } from '../types/gltf';
import type { GLTF } from '../types/gltf';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';

interface ICamera extends IExtensibleProperty {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/properties/extensible-property.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Nullable } from '../constants';
import { ExtensionProperty } from './extension-property';
import type { Nullable } from '../constants';
import type { ExtensionProperty } from './extension-property';
import { Property, IProperty } from './property';

export interface IExtensibleProperty extends IProperty {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/properties/extension-property.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ExtensibleProperty } from './extensible-property';
import type { ExtensibleProperty } from './extensible-property';
import { Property, IProperty } from './property';

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/properties/material.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Nullable, PropertyType, TextureChannel, vec3, vec4 } from '../constants';
import { GLTF } from '../types/gltf';
import type { GLTF } from '../types/gltf';
import { ColorUtils } from '../utils';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';
import { Texture } from './texture';
import type { Texture } from './texture';
import { TextureInfo } from './texture-info';

const { R, G, B, A } = TextureChannel;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/properties/mesh.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Nullable, PropertyType } from '../constants';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';
import { Primitive } from './primitive';
import type { Primitive } from './primitive';

interface IMesh extends IExtensibleProperty {
weights: number[];
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/properties/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { multiply } from 'gl-matrix/mat4';
import { PropertyType, mat4, vec3, vec4, Nullable } from '../constants';
import { $attributes } from 'property-graph';
import { MathUtils } from '../utils';
import { Camera } from './camera';
import type { Camera } from './camera';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';
import { Mesh } from './mesh';
import type { Mesh } from './mesh';
import { COPY_IDENTITY } from './property';
import { Skin } from './skin';
import type { Skin } from './skin';

interface INode extends IExtensibleProperty {
translation: vec3;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/properties/primitive-target.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BufferViewUsage, Nullable, PropertyType } from '../constants';
import { Accessor } from './accessor';
import { IExtensibleProperty } from './extensible-property';
import type { Accessor } from './accessor';
import type { IExtensibleProperty } from './extensible-property';
import { Property } from './property';

interface IPrimitiveTarget extends IExtensibleProperty {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/properties/primitive.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { BufferViewUsage, Nullable, PropertyType } from '../constants';
import { GLTF } from '../types/gltf';
import { Accessor } from './accessor';
import type { GLTF } from '../types/gltf';
import type { Accessor } from './accessor';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';
import { Material } from './material';
import { PrimitiveTarget } from './primitive-target';
import type { Material } from './material';
import type { PrimitiveTarget } from './primitive-target';

interface IPrimitive extends IExtensibleProperty {
mode: GLTF.MeshPrimitiveMode;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/properties/property.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Nullable } from '../constants';
import type { Nullable } from '../constants';
import { $attributes, $immutableKeys, Graph, GraphNode, GraphEdge, isRef, isRefList, isRefMap } from 'property-graph';
import { equalsArray, equalsObject, equalsRef, equalsRefList, equalsRefMap, isArray, isPlainObject } from '../utils';
import type { Ref, RefMap, UnknownRef } from '../utils';
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/properties/root.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Nullable, PropertyType, VERSION } from '../constants';
import { Extension } from '../extension';
import { Graph } from 'property-graph';
import type { Extension } from '../extension';
import type { Graph } from 'property-graph';
import { Accessor } from './accessor';
import { Animation } from './animation';
import { Buffer } from './buffer';
Expand All @@ -13,7 +13,7 @@ import { Scene } from './scene';
import { Skin } from './skin';
import { Texture } from './texture';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';
import { ExtensionProperty } from './extension-property';
import type { ExtensionProperty } from './extension-property';

interface IAsset {
version: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/properties/scene.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Nullable, PropertyType } from '../constants';
import { $attributes } from 'property-graph';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';
import { Node } from './node';
import type { Node } from './node';
import { COPY_IDENTITY } from './property';

interface IScene extends IExtensibleProperty {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/properties/skin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BufferViewUsage, Nullable, PropertyType } from '../constants';
import { Accessor } from './accessor';
import type { Accessor } from './accessor';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';
import { Node } from './node';
import type { Node } from './node';

interface ISkin extends IExtensibleProperty {
skeleton: Node;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/properties/texture-info.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Nullable, PropertyType } from '../constants';
import { GLTF } from '../types/gltf';
import type { GLTF } from '../types/gltf';
import { ExtensibleProperty, IExtensibleProperty } from './extensible-property';

interface ITextureInfo extends IExtensibleProperty {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/buffer-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypedArray } from '../constants';
import type { TypedArray } from '../constants';

/**
* # BufferUtils
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/color-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { vec3, vec4 } from '../constants';
import type { vec3, vec4 } from '../constants';

/**
* # ColorUtils
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/image-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { vec2 } from '../constants';
import type { vec2 } from '../constants';
import { BufferUtils } from './buffer-utils';

/** Implements support for an image format in the {@link ImageUtils} class. */
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/math-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { determinant, getRotation } from 'gl-matrix/mat4';
import { length } from 'gl-matrix/vec3';
import { mat4, vec3, vec4 } from '../constants';
import { GLTF } from '../types/gltf';
import type { mat4, vec3, vec4 } from '../constants';
import type { GLTF } from '../types/gltf';

/** @hidden */
export class MathUtils {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/property-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GraphEdge } from 'property-graph';
import type { GraphEdge } from 'property-graph';
import { isPlainObject } from './is-plain-object';
import { BufferViewUsage } from '../constants';
import type { BufferViewUsage } from '../constants';
import type { Property } from '../properties';

export type Ref = GraphEdge<Property, Property>;
Expand Down
1 change: 1 addition & 0 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"compilerOptions": {
"outDir": "dist",
"strict": true,
"importsNotUsedAsValues": "error",
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GLTF, TypedArray } from '@gltf-transform/core';
import type { GLTF, TypedArray } from '@gltf-transform/core';

export enum EncoderMethod {
QUANTIZE = 'quantize',
Expand Down
4 changes: 2 additions & 2 deletions packages/extensions/src/ext-meshopt-compression/decoder.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EXT_MESHOPT_COMPRESSION } from '../constants';
import { GLTF } from '@gltf-transform/core';
import { MeshoptBufferExtension } from './constants';
import type { GLTF } from '@gltf-transform/core';
import type { MeshoptBufferExtension } from './constants';

/**
* Returns true for a fallback buffer, else false.
Expand Down
Loading

0 comments on commit d77ca6a

Please sign in to comment.