Skip to content

Commit

Permalink
Convert $FlowFixMe for untyped imports to flowlint off
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Binns-Smith committed Apr 7, 2020
1 parent 68b5050 commit 68a6867
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
3 changes: 2 additions & 1 deletion flow-libs/postcss.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// Derived from the PostCSS docs available at
// http://api.postcss.org/postcss.html.

import type {SourceMapGenerator} from 'source-map';
// eslint-disable-next-line import/no-extraneous-dependencies
import typeof {SourceMapGenerator} from 'source-map';

declare module 'postcss' {
declare type NodeCallback = (Node, number) => false | void;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/cache/src/Cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {FileSystem} from '@parcel/fs';
import path from 'path';
import logger from '@parcel/logger';
import {serialize, deserialize, registerSerializableClass} from '@parcel/core';
// $FlowFixMe this is untyped
// flowlint-next-line untyped-import:off
import packageJson from '../package.json';

export default class Cache {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Graph from './Graph';
import ParcelConfig from './ParcelConfig';
import {RequestGraph} from './RequestTracker';
import Config from './public/Config';
// $FlowFixMe this is untyped
// flowlint-next-line untyped-import:off
import packageJson from '../package.json';

export function getBundleGroupId(bundleGroup: BundleGroup): string {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/register/src/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import type {IDisposable, InitialParcelOptions} from '@parcel/types';

import {NodePackageManager} from '@parcel/package-manager';
import {NodeFS} from '@parcel/fs';
// $FlowFixMe this is untyped
// flowlint-next-line untyped-import:off
import defaultConfigContents from '@parcel/config-default';
// $FlowFixMe this is untyped
// $FlowFixMe Flow can't resolve this
import Module from 'module';
import path from 'path';
// $FlowFixMe this is untyped
// flowlint-next-line untyped-import:off
import {addHook} from 'pirates';
import Parcel, {INTERNAL_RESOLVE, INTERNAL_TRANSFORM} from '@parcel/core';

Expand Down
2 changes: 1 addition & 1 deletion packages/core/utils/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export {default as objectHash} from './objectHash';
export {default as prettifyTime} from './prettifyTime';
export {default as prettyDiagnostic} from './prettyDiagnostic';
export {default as PromiseQueue} from './PromiseQueue';
// $FlowFixMe this is untyped
// flowlint-next-line untyped-import:off
export {default as promisify} from './promisify';
export {default as validateSchema} from './schema';
export {default as TapStream} from './TapStream';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/utils/src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import ThrowableDiagnostic, {
generateJSONCodeHighlights,
} from '@parcel/diagnostic';
// $FlowFixMe untyped
// flowlint-next-line untyped-import:off
import levenshteinDistance from 'js-levenshtein';

export type SchemaEntity =
Expand Down
12 changes: 10 additions & 2 deletions packages/optimizers/cssnano/src/CSSNanoOptimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import {Optimizer} from '@parcel/plugin';
import postcss from 'postcss';
// $FlowFixMe this is untyped
// flowlint-next-line untyped-import:off
import cssnano from 'cssnano';

export default new Optimizer({
Expand All @@ -17,8 +17,16 @@ export default new Optimizer({
);
}

const results = await postcss([cssnano]).process(contents, {
from: bundle.filePath,
map: {inline: false},
});

console.log('MAP', results.map.constructor);

return {
contents: (await postcss([cssnano]).process(contents)).css,
contents: results.css,
map: results.map,
};
},
});
2 changes: 1 addition & 1 deletion packages/optimizers/htmlnano/src/HTMLNanoOptimizer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow strict-local

// $FlowFixMe this is untyped
// flowlint-next-line untyped-import:off
import htmlnano from 'htmlnano';
import {loadConfig} from '@parcel/utils';
import {Optimizer} from '@parcel/plugin';
Expand Down

0 comments on commit 68a6867

Please sign in to comment.