Skip to content

Commit

Permalink
Enable import sorting (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Jul 24, 2024
1 parent 65014ac commit 6121ef4
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 30 deletions.
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./node_modules/gts/",
"rules": {
"prefer-const": ["error", {"destructuring": "all"}],
// It would be nice to sort import declaration order as well, but that's not
// autofixable and it's not worth the effort of handling manually.
"sort-imports": ["error", {"ignoreDeclarationSort": true}],
}
}
6 changes: 0 additions & 6 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion lib/src/compiler/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as p from 'path';
import * as supportsColor from 'supports-color';
import {deprecations, getDeprecationIds, Deprecation} from '../deprecations';
import {Deprecation, deprecations, getDeprecationIds} from '../deprecations';
import {deprotofySourceSpan} from '../deprotofy-span';
import {Dispatcher, DispatcherHandlers} from '../dispatcher';
import {Exception} from '../exception';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {filter, map, mergeMap, takeUntil} from 'rxjs/operators';
import {OutboundResponse} from './messages';
import * as proto from './vendor/embedded_sass_pb';
import {RequestTracker} from './request-tracker';
import {PromiseOr, compilerError, thenOr, hostError} from './utils';
import {PromiseOr, compilerError, hostError, thenOr} from './utils';

// A callback that accepts a response or error.
type ResponseCallback = (
Expand Down
2 changes: 1 addition & 1 deletion lib/src/importer-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {CanonicalizeContext} from './canonicalize-context';
import * as utils from './utils';
import {FileImporter, Importer, Options} from './vendor/sass';
import * as proto from './vendor/embedded_sass_pb';
import {catchOr, thenOr, PromiseOr} from './utils';
import {PromiseOr, catchOr, thenOr} from './utils';

const entryPointDirectoryKey = Symbol();

Expand Down
6 changes: 3 additions & 3 deletions lib/src/legacy/importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import * as util from 'util';

import {resolvePath} from './resolve-path';
import {
PromiseOr,
SyncBoolean,
fileUrlToPathCrossPlatform,
isErrnoException,
thenOr,
PromiseOr,
SyncBoolean,
} from '../utils';
import {
Importer,
Expand All @@ -26,10 +26,10 @@ import {
LegacySyncImporter,
} from '../vendor/sass';
import {
pathToLegacyFileUrl,
legacyFileUrlToPath,
legacyImporterProtocol,
legacyImporterProtocolPrefix,
pathToLegacyFileUrl,
} from './utils';

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/src/legacy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as fs from 'fs';
import * as p from 'path';
import {pathToFileURL, URL} from 'url';
import {URL, pathToFileURL} from 'url';
import {NodePackageImporter} from '../importer-registry';

import {Exception} from '../exception';
Expand All @@ -15,11 +15,11 @@ import {
compileStringAsync,
} from '../compile';
import {
SyncBoolean,
fileUrlToPathCrossPlatform,
isNullOrUndefined,
pathToUrlString,
withoutExtension,
SyncBoolean,
} from '../utils';
import {
CompileResult,
Expand All @@ -34,7 +34,7 @@ import {
StringOptions,
} from '../vendor/sass';
import {wrapFunction} from './value/wrap';
import {endOfLoadProtocol, LegacyImporterWrapper} from './importer';
import {LegacyImporterWrapper, endOfLoadProtocol} from './importer';
import {
legacyImporterProtocol,
pathToLegacyFileUrl,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/message-transformer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import {Subject, Observable} from 'rxjs';
import {Observable, Subject} from 'rxjs';
import * as varint from 'varint';

import {expectObservableToError} from '../../test/utils';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/packet-transformer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import {Subject, Observable} from 'rxjs';
import {Observable, Subject} from 'rxjs';

import {PacketTransformer} from './packet-transformer';

Expand Down
8 changes: 4 additions & 4 deletions lib/src/protofier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import {FunctionRegistry} from './function-registry';
import {SassArgumentList} from './value/argument-list';
import {SassColor} from './value/color';
import {SassFunction} from './value/function';
import {SassList, ListSeparator} from './value/list';
import {ListSeparator, SassList} from './value/list';
import {SassMap} from './value/map';
import {SassNumber} from './value/number';
import {SassString} from './value/string';
import {Value} from './value';
import {sassNull} from './value/null';
import {sassTrue, sassFalse} from './value/boolean';
import {sassFalse, sassTrue} from './value/boolean';
import {
CalculationValue,
SassCalculation,
CalculationInterpolation,
CalculationOperation,
CalculationOperator,
CalculationValue,
SassCalculation,
} from './value/calculations';
import {SassMixin} from './value/mixin';

Expand Down
2 changes: 1 addition & 1 deletion lib/src/sync-process/sync-message-port.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import {strict as assert} from 'assert';
import {EventEmitter} from 'events';
import {
receiveMessageOnPort,
MessageChannel,
MessagePort,
TransferListItem,
receiveMessageOnPort,
} from 'worker_threads';

// TODO(nex3): Make this its own package.
Expand Down
6 changes: 3 additions & 3 deletions lib/src/sync-process/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// https://opensource.org/licenses/MIT.

import {
parentPort,
workerData,
MessagePort,
TransferListItem,
parentPort,
workerData,
} from 'worker_threads';
import {spawn, SpawnOptionsWithoutStdio} from 'child_process';
import {SpawnOptionsWithoutStdio, spawn} from 'child_process';
import {strict as assert} from 'assert';

import {SyncMessagePort} from './sync-message-port';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/value/argument-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import {isOrderedMap, List, OrderedMap} from 'immutable';
import {List, OrderedMap, isOrderedMap} from 'immutable';

import {ListSeparator, SassList} from './list';
import {Value} from './index';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/value/calculations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import {hash, List, ValueObject} from 'immutable';
import {List, ValueObject, hash} from 'immutable';

import {Value} from './index';
import {SassNumber} from './number';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/value/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import {hash, isList, List} from 'immutable';
import {List, hash, isList} from 'immutable';

import {Value} from './index';
import {SassMap} from './map';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/value/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import {hash, List} from 'immutable';
import {List, hash} from 'immutable';

import {asImmutableList, valueError} from '../utils';
import {Value} from './index';
Expand Down
2 changes: 1 addition & 1 deletion tool/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import {promises as fs, existsSync, lstatSync} from 'fs';
import {existsSync, promises as fs, lstatSync} from 'fs';
import * as p from 'path';
import * as shell from 'shelljs';

Expand Down

0 comments on commit 6121ef4

Please sign in to comment.