Skip to content

Commit

Permalink
ESLint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMessinger committed Jul 16, 2020
1 parent 127a17e commit f6e4880
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@

root: true
extends: "@jsdevtools"

env:
node: true
1 change: 0 additions & 1 deletion src/create-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function createFilter(options: Options, ...args: unknown[]): FilterFuncti
(pathFilter as PathFilter)[_filters] = filters;
return pathFilter;

// tslint:disable-next-line: no-shadowed-variable
function pathFilter(...args: unknown[]): boolean {
// Does the file path match any of the exclude filters?
let exclude = filters.exclude.some((filter) => filter(...args));
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export { createFilter } from "./create-filter";
export { filePathFilter };

// Export `filePathFilter` as a named export and the default export
// tslint:disable: no-default-export
export default filePathFilter;

// CommonJS default export hack
/* eslint-env commonjs */
if (typeof module === "object" && typeof module.exports === "object") {
module.exports = Object.assign(module.exports.default, module.exports); // tslint:disable-line: no-unsafe-any
module.exports = Object.assign(module.exports.default, module.exports);
}
9 changes: 4 additions & 5 deletions src/normalize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as GlobToRegExp from "glob-to-regexp";
import * as globToRegExp from "glob-to-regexp";
import * as path from "path";
import { AnyFilter, Filter, FilterCriterion, FilterFunction, Filters, Options } from "./types";
import { isFilterCriterion, isPathFilter, _filters } from "./util";
Expand Down Expand Up @@ -34,7 +34,6 @@ type NormalizedOptions = Required<Options>;
function normalizeOptions(options: Options): NormalizedOptions {
return {
// TODO: Remove the "getPath" fallback in the next minor release
// tslint:disable-next-line: no-unsafe-any no-any
map: options.map || (options as any).getPath || String,
sep: options.sep || path.sep,
};
Expand All @@ -44,7 +43,7 @@ function normalizeOptions(options: Options): NormalizedOptions {
* Creates a `FilterFunction` for each given criterion.
*/
function normalizeCriteria(
criteria: AnyFilter, options: NormalizedOptions, filter?: Filter): Array<[Filter, FilterFunction]> {
criteria: AnyFilter, options: NormalizedOptions, filter?: Filter): Array<[Filter, FilterFunction]> {
let tuples: Array<[Filter, FilterFunction]> = [];

if (Array.isArray(criteria)) {
Expand Down Expand Up @@ -86,7 +85,7 @@ criteria: AnyFilter, options: NormalizedOptions, filter?: Filter): Array<[Filter
* @param filter - The type of filter. Defaults to `include`, except for glob patterns that start with "!"
*/
function normalizeCriterion(
criterion: FilterCriterion, options: NormalizedOptions, filter?: Filter): [Filter, FilterFunction] {
criterion: FilterCriterion, options: NormalizedOptions, filter?: Filter): [Filter, FilterFunction] {
const globOptions = { extended: true, globstar: true };
let type = typeof criterion;
let filterFunction: FilterFunction;
Expand All @@ -110,7 +109,7 @@ criterion: FilterCriterion, options: NormalizedOptions, filter?: Filter): [Filte
filter = filter || "exclude";
}

let pattern = GlobToRegExp(glob, globOptions);
let pattern = globToRegExp(glob, globOptions);
filterFunction = createGlobFilter(pattern, options, invert);
}
else if (criterion instanceof RegExp) {
Expand Down
1 change: 1 addition & 0 deletions test/specs/glob.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ describe("Globs", () => {
]);
});

/* eslint-env node */
if (process.platform === "win32") {
it("should filter Windows file paths", () => {
const windowsPaths = Object.freeze(paths.map((path) =>
Expand Down

0 comments on commit f6e4880

Please sign in to comment.