Skip to content
Permalink
Browse files

Breaking: Group types with utils implementation

Fix #2392
Close #3382
  • Loading branch information
sarvaje authored and molant committed Nov 22, 2019
1 parent b9d323f commit d59be963309bf0df971f374a010d21312c2efd3e
@@ -16,7 +16,7 @@ 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 { HintConfig } from '@hint/utils/dist/src/config/types';
import { HttpHeaders, Problem, Severity } from '@hint/utils-types';
import { HTMLDocument, HTMLElement } from '@hint/utils-dom';
import { debug as d } from '@hint/utils-debug';
@@ -10,9 +10,8 @@ import * as globby from 'globby';
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 { ResourceError } from '@hint/utils/dist/src/packages/resource-error';
import { ResourceType, ResourceErrorStatus } from '@hint/utils/dist/src/packages/enums';

import { Configuration } from '../../../src/lib/config';

@@ -1,7 +1,7 @@
import normalizeHints from './normalize-hints';
import { loadResource } from '../packages/load-resource';
import { ResourceType } from '../types/resource-type';
import { UserConfig, HintsConfigObject } from '../types/config';
import { ResourceType } from '../packages/enums';
import { UserConfig, HintsConfigObject } from './types';

const getHintsFromExtend = (extendName: string, parentConfigs: string[] = []) => {
try {
@@ -1,3 +1,4 @@
export { default as normalizeHints } from './normalize-hints';
export * from './to-absolute-paths';
export * from './get-hints-from-configuration';
export * from './types';
@@ -1,4 +1,4 @@
import { HintsConfigObject, HintSeverity } from '../types/config';
import { HintsConfigObject, HintSeverity } from './types';
import { Severity } from '@hint/utils-types';

/**
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';

import { UserConfig, HintsConfigObject } from '../types/config';
import { UserConfig, HintsConfigObject } from './types';

export const toAbsolutePaths = (config: UserConfig | null, configRoot: string): UserConfig | null => {
if (!config) {
File renamed without changes.
@@ -1,3 +1,10 @@
export enum ResourceErrorStatus {
DependencyError = 'DependencyError',
NotCompatible = 'NotCompatible',
NotFound = 'NotFound',
Unknown = 'Unknown'
}

/** The type of resource */
export enum ResourceType {
configuration = 'configuration',
@@ -1,4 +1,4 @@
import { ResourceType } from '../types/resource-type';
import { ResourceType } from './enums';

/**
* Check if it is a package with multiple resources.
@@ -1,3 +1,4 @@
export * from './enums';
export * from './find-node-modules-root';
export * from './find-package-root';
export * from './is-official';
@@ -7,3 +8,4 @@ export * from './has-multiple-resources';
export * from './is-full-package-name';
export * from './load-hint-package';
export * from './require-package';
export * from './resource-error';
@@ -1,4 +1,4 @@
import { ResourceType } from '../types/resource-type';
import { ResourceType } from './enums';

/**
* Check if a name represents a full package name for the specified resource type.
@@ -8,14 +8,13 @@ import { cwd, loadJSONFile } from '@hint/utils-fs';
import { debug as d } from '@hint/utils-debug';
import { normalizeIncludes } from '@hint/utils-string';
import { isFullPackageName } from './is-full-package-name';
import { ResourceType } from '../types/resource-type';
import { loadPackage } from './load-package';
import { loadHintPackage } from './load-hint-package';
import { requirePackage } from './require-package';
import { hasMultipleResources } from './has-multiple-resources';
import { toAbsolutePaths } from '../config/to-absolute-paths';
import { ResourceErrorStatus } from '../types/resource-error-status';
import { ResourceError } from '../types/resource-error';
import { ResourceErrorStatus, ResourceType } from './enums';
import { ResourceError } from './resource-error';

const debug: debug.IDebugger = d(__filename);

@@ -1,4 +1,4 @@
import { ResourceErrorStatus } from './resource-error-status';
import { ResourceErrorStatus } from './enums';

export class ResourceError extends Error {
public status: ResourceErrorStatus;
@@ -1,5 +1 @@
export * from './config';
export * from './npm';
export * from './resource-error';
export * from './resource-error-status';
export * from './resource-type';

This file was deleted.

@@ -5,7 +5,7 @@ import * as sinon from 'sinon';
import * as proxyquire from 'proxyquire';

import { loadJSONFile } from '@hint/utils-fs';
import { ResourceType } from '../../src/types/resource-type';
import { ResourceType } from '../../src/packages/enums';

const configurationWithoutHints = loadJSONFile(path.join(__dirname, 'fixtures', 'configurationWithoutHints.json'));
const configurationWithHints = loadJSONFile(path.join(__dirname, 'fixtures', 'configurationWithHints.json'));
@@ -1,6 +1,6 @@
import test from 'ava';
import normalizeHints from '../../src/config/normalize-hints';
import { HintsConfigObject } from '../../src/types/config';
import { HintsConfigObject } from '../../src/config';

test(`should normalize basic hints`, (t) => {
const hints = [
@@ -2,7 +2,7 @@ import anyTest, { TestInterface } from 'ava';
import * as sinon from 'sinon';
import * as proxyquire from 'proxyquire';

import { ResourceType } from '../../src/types/resource-type';
import { ResourceType } from '../../src/packages/enums';

const fakeResource = {};
const fakeHint = { meta: {} };

0 comments on commit d59be96

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