Skip to content
Permalink
Browse files

Breaking: Remove shortcuts to @hint/utils from hint

Fix #3166
  • Loading branch information
sarvaje committed Nov 20, 2019
1 parent f044c9b commit 39d824913aab033afdb3e2f7c23331ef228634f6
@@ -10,7 +10,6 @@ import {
HintResources,
IFormatter,
Target,
UserConfig,
Endpoint,
AnalyzerResult
} from './types';
@@ -19,7 +18,7 @@ import { AnalyzerErrorStatus } from './enums/error-status';
import { IFormatterConstructor } from './types/formatters';
import { loadResources } from './utils/resource-loader';

import { logger } from '@hint/utils';
import { logger, UserConfig } from '@hint/utils';
import { cutString } from '@hint/utils-string';
import {
cwd,
@@ -17,9 +17,8 @@
import * as chalk from 'chalk';
import * as updateNotifier from 'update-notifier';

import { logger } from '@hint/utils';
import { loadHintPackage, logger } from '@hint/utils';

import { loadHintPackage } from './utils/packages';
import { CLIOptions } from './types';
import { options } from './cli/options';
import { cliActions } from './cli/actions';
@@ -15,9 +15,11 @@ import {
HintsConfigObject,
HintSeverity,
installPackages,
loadHintPackage,
logger,
mergeEnvWithOptions,
normalizeHints
normalizeHints,
UserConfig
} from '@hint/utils';
import { cwd } from '@hint/utils-fs';
import { getAsUris } from '@hint/utils-network';
@@ -29,10 +31,8 @@ import {
AnalyzeOptions,
CLIOptions,
CreateAnalyzerOptions,
HintResources,
UserConfig
HintResources
} from '../types';
import { loadHintPackage } from '../utils/packages/load-hint-package';
import { createAnalyzer, getUserConfig } from '../';
import { Analyzer } from '../analyzer';
import { AnalyzerErrorStatus } from '../enums/error-status';
@@ -1,5 +1,4 @@
import { logger } from '@hint/utils';
import { loadHintPackage } from '../utils/packages/load-hint-package';
import { logger, loadHintPackage } from '@hint/utils';

/** Prints the current hint version in the console. */
export default (): Promise<boolean> => {
@@ -19,7 +19,17 @@ import * as path from 'path';
import browserslist = require('browserslist'); // `require` used because `browserslist` exports a function
import mergeWith = require('lodash/mergeWith');

import { toAbsolutePaths } from '@hint/utils';
import {
ConnectorConfig,
HintsConfigObject,
HintSeverity,
IgnoredUrl,
loadResource,
normalizeHints,
ResourceType,
toAbsolutePaths,
UserConfig
} from '@hint/utils';
import {
isFile,
loadJSFile,
@@ -28,12 +38,10 @@ import {
import { debug as d } from '@hint/utils-debug';
import { validate as schemaValidator } from '@hint/utils-json';

import { UserConfig, IgnoredUrl, ConnectorConfig, HintsConfigObject, HintSeverity, CreateAnalyzerOptions } from './types';
import { CreateAnalyzerOptions } from './types';
import { validateConfig } from './config/config-validator';
import normalizeHints from './config/normalize-hints';
import { validate as validateHint, getSeverity } from './config/config-hints';
import * as resourceLoader from './utils/resource-loader';
import { ResourceType } from './enums';
import { IConnectorConstructor } from './types/connector';

const debug: debug.IDebugger = d(__filename);
@@ -307,7 +315,7 @@ export class Configuration {

debug(`Validating ${connectorId} connector`);

const Connector = resourceLoader.loadResource(connectorId, ResourceType.connector) as IConnectorConstructor;
const Connector = loadResource(connectorId, ResourceType.connector) as IConnectorConstructor;

debug(`Connector schema:`);
debug(Connector.schema);
@@ -12,8 +12,9 @@ import { debug as d } from '@hint/utils-debug';

import { validate as schemaValidator } from '@hint/utils-json';
import { Severity } from '@hint/utils-types';
import { HintConfig } from '@hint/utils';

import { HintMetadata, HintConfig } from '../types';
import { HintMetadata } from '../types';

const debug = d(__filename);

@@ -9,13 +9,11 @@
* ------------------------------------------------------------------------------
*/

import { logger } from '@hint/utils';
import { logger, UserConfig } from '@hint/utils';
import { debug as d } from '@hint/utils-debug';

import { GroupedError, SchemaValidationResult, validate } from '@hint/utils-json';

import { UserConfig } from '../types';

const debug = d(__filename);
const schema = require('./config-schema.json');

This file was deleted.

@@ -16,14 +16,14 @@ import { EventEmitter2 as EventEmitter } from 'eventemitter2';
import remove = require('lodash/remove');

import * as logger from '@hint/utils/dist/src/logging';
import { HintConfig } from '@hint/utils/dist/src/types/config';
import { HttpHeaders, Problem, Severity } from '@hint/utils-types';
import { HTMLDocument, HTMLElement } from '@hint/utils-dom';
import { debug as d } from '@hint/utils-debug';

import { getSeverity } from './config/config-hints';
import {
Events,
HintConfig,
HintResources,
IConnector,
IConnectorConstructor,
@@ -1,5 +1,3 @@
export * from '@hint/utils/dist/src/types/resource-error-status';

export enum AnalyzerErrorStatus {
AnalyzeError = 'AnalyzeError',
ConfigurationError = 'ConfigurationError',
@@ -1,3 +1,2 @@
export * from './error-status';
export * from './hint-scope';
export * from './resource-type';

This file was deleted.

@@ -3,7 +3,6 @@ import { IConnectorConstructor } from './types/connector';
import { IParserConstructor } from './types/parser';
import { IHintConstructor } from './types/hints';

export * from '@hint/utils/dist/src/types/config';
export * from './types/connector';
export * from './types/events';
export * from './types/formatters';
@@ -1,5 +1,6 @@
import { Problem } from '@hint/utils-types';
import { UserConfig, HintResources } from '../types';
import { UserConfig } from '@hint/utils';
import { HintResources } from '../types';

export type FormatterOptions = {
config?: UserConfig;
@@ -1,7 +1,5 @@
import * as packagesUtils from './packages';
import * as resourceLoaderUtils from './resource-loader';

export * from './resource-loader';

export const packages = packagesUtils;
export const resourceLoader = resourceLoaderUtils;

This file was deleted.

This file was deleted.

@@ -21,19 +21,17 @@ import {
hasMultipleResources,
isFullPackageName,
loadResource,
requirePackage
requirePackage,
ResourceErrorStatus,
ResourceType
} from '@hint/utils';
import { readFile } from '@hint/utils-fs';
import { debug as d } from '@hint/utils-debug';

import { IHintConstructor, HintResources } from '../types';
import { Configuration } from '../config';
import { ResourceType } from '../enums/resource-type';
import { ResourceErrorStatus } from '../enums/error-status';
import { IConnectorConstructor } from '../types/connector';

export * from '@hint/utils/dist/src/packages/load-resource';

const debug: debug.IDebugger = d(__filename);
const HINT_ROOT: string = findPackageRoot();
const NODE_MODULES_ROOT: string = (() => {
@@ -4,13 +4,13 @@ import anyTest, { TestInterface } from 'ava';
import * as proxyquire from 'proxyquire';
import * as sinon from 'sinon';

import { ConnectorConfig, UserConfig } from '@hint/utils';

import {
AnalyzerError,
ConnectorConfig,
HintResources,
IFetchOptions,
IFormatter,
UserConfig
IFormatter
} from '../../src/lib/types';
import { AnalyzerErrorStatus } from '../../src/lib/enums/error-status';
import { Problem } from '@hint/utils-types';
@@ -63,8 +63,10 @@ const initContext = (t: ExecutionContext<ConfigTestContext>) => {
const loadScript = (context: ConfigTestContext) => {
return proxyquire('../../src/lib/cli', {
'./cli/actions': context.cliActions,
'./utils/packages': context.loadHintPackage,
'@hint/utils': { logger: context.logger },
'@hint/utils': {
loadHintPackage: context.loadHintPackage.loadHintPackage,
logger: context.logger
},
'update-notifier': context.updateNotifier
});
};
@@ -3,6 +3,7 @@ import * as sinon from 'sinon';
import anyTest, { TestInterface, ExecutionContext } from 'ava';

import * as utils from '@hint/utils';
import { HintsConfigObject, UserConfig } from '@hint/utils';
import { Problem, Severity } from '@hint/utils-types';
import * as network from '@hint/utils-network';

@@ -12,9 +13,7 @@ import {
AnalyzerResult,
CLIOptions,
CreateAnalyzerOptions,
Endpoint,
UserConfig,
HintsConfigObject
Endpoint
} from '../../../src/lib/types';
import { AnalyzerErrorStatus } from '../../../src/lib/enums/error-status';

@@ -1,7 +1,8 @@
import test from 'ava';

import { HintConfig } from '@hint/utils';
import * as configHints from '../../../src/lib/config/config-hints';
import { HintConfig, IHint, HintMetadata } from '../../../src/lib/types';
import { IHint, HintMetadata } from '../../../src/lib/types';
import { HintScope } from '../../../src/lib/enums/hint-scope';
import { HintContext } from '../../../src/lib/hint-context';

@@ -11,10 +11,10 @@ import * as proxyquire from 'proxyquire';

import * as utils from '@hint/utils';
import { ResourceError } from '@hint/utils/dist/src/types/resource-error';
import { ResourceErrorStatus } from '@hint/utils/dist/src/types/resource-error-status';
import { ResourceType } from '@hint/utils/dist/src/types/resource-type';

import { Configuration } from '../../../src/lib/config';
import { ResourceType } from '../../../src/lib/enums/resource-type';
import { ResourceErrorStatus } from '../../../src/lib/enums/error-status';

const installedConnectors = [
path.join(__dirname, 'fixtures', 'connector1', 'package.json'),

0 comments on commit 39d8249

Please sign in to comment.
You can’t perform that action at this time.