Skip to content

Commit

Permalink
Merge pull request #463 from mrmlnc/update_eslint_flat
Browse files Browse the repository at this point in the history
Update ESLint to version with flat config
  • Loading branch information
mrmlnc authored Nov 23, 2024
2 parents 57c658a + 14a1f6c commit 3e7a83b
Show file tree
Hide file tree
Showing 35 changed files with 157 additions and 100 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
run: npm install
- name: Run Hygiene Checks
run: npm run lint
if: ${{ matrix.node_version >= 18 }}
- name: Prepare bundle
run: npm run bundle
- name: Run unit tests
Expand Down
3 changes: 3 additions & 0 deletions __snapshots__/absolute.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ exports['Options Absolute {"pattern":"fixtures/**/*","options":{"absolute":true}
]

exports['Options Absolute {"pattern":"fixtures/../*","options":{"absolute":true}} (sync) 1'] = [
"<root>/eslint.config.mjs",
"<root>/herebyfile.mjs",
"<root>/LICENSE",
"<root>/package.json",
Expand All @@ -97,6 +98,7 @@ exports['Options Absolute {"pattern":"fixtures/../*","options":{"absolute":true}
]

exports['Options Absolute {"pattern":"fixtures/../*","options":{"absolute":true}} (async) 1'] = [
"<root>/eslint.config.mjs",
"<root>/herebyfile.mjs",
"<root>/LICENSE",
"<root>/package.json",
Expand All @@ -105,6 +107,7 @@ exports['Options Absolute {"pattern":"fixtures/../*","options":{"absolute":true}
]

exports['Options Absolute {"pattern":"fixtures/../*","options":{"absolute":true}} (stream) 1'] = [
"<root>/eslint.config.mjs",
"<root>/herebyfile.mjs",
"<root>/LICENSE",
"<root>/package.json",
Expand Down
3 changes: 3 additions & 0 deletions __snapshots__/regular.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -5492,6 +5492,7 @@ exports['Patterns Regular (segmented lists) {"pattern":"{book.xml,library/**/a/b
]

exports['Patterns Regular (relative) {"pattern":"./*","options":{}} (sync) 1'] = [
"eslint.config.mjs",
"herebyfile.mjs",
"LICENSE",
"package.json",
Expand All @@ -5500,6 +5501,7 @@ exports['Patterns Regular (relative) {"pattern":"./*","options":{}} (sync) 1'] =
]

exports['Patterns Regular (relative) {"pattern":"./*","options":{}} (async) 1'] = [
"eslint.config.mjs",
"herebyfile.mjs",
"LICENSE",
"package.json",
Expand All @@ -5508,6 +5510,7 @@ exports['Patterns Regular (relative) {"pattern":"./*","options":{}} (async) 1']
]

exports['Patterns Regular (relative) {"pattern":"./*","options":{}} (stream) 1'] = [
"eslint.config.mjs",
"herebyfile.mjs",
"LICENSE",
"package.json",
Expand Down
8 changes: 8 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import cfg from 'eslint-config-mrmlnc';

/** @type {import('eslint').Linter.Config[]} */
const overrides = [
...cfg.build({}),
];

export default overrides;
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@
"@nodelib/fs.macchiato": "^2.0.0",
"@types/glob-parent": "^5.1.3",
"@types/merge2": "^1.4.4",
"@types/micromatch": "^4.0.5",
"@types/mocha": "^10.0.4",
"@types/micromatch": "^4.0.9",
"@types/mocha": "^10.0.9",
"@types/node": "^16.18.61",
"@types/picomatch": "^2.3.3",
"@types/sinon": "^17.0.1",
"@types/picomatch": "^3.0.1",
"@types/sinon": "^17.0.3",
"bencho": "^0.1.1",
"esbuild": "^0.19.5",
"eslint": "^8.53.0",
"eslint-config-mrmlnc": "^4.1.0",
"esbuild": "^0.24.0",
"eslint": "9.14.0",
"eslint-config-mrmlnc": "^5.0.0",
"execa": "^7.2.0",
"fast-glob": "^3.3.2",
"fdir": "^6.1.1",
"fdir": "^6.4.2",
"glob": "^11.0.0",
"hereby": "^1.8.8",
"mocha": "^10.2.0",
"hereby": "^1.10.0",
"mocha": "^10.8.2",
"rimraf": "^6.0.1",
"sinon": "^17.0.1",
"sinon": "^19.0.2",
"snap-shot-it": "^7.9.10",
"typescript": "^5.2.2"
"typescript": "^5.6.3"
},
"dependencies": {
"@nodelib/fs.stat": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/benchmark/suites/product/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Glob {

const action = new Promise<string[]>((resolve, reject) => {
stream.on('error', (error) => {
reject(error);
reject(error as Error);
});
stream.on('data', (entry: string) => entries.push(entry));
stream.on('end', () => {
Expand All @@ -52,7 +52,7 @@ class Glob {
});

const action = new Promise<string[]>((resolve, reject) => {
stream.once('error', (error) => {
stream.once('error', (error: Error) => {
reject(error);
});
stream.on('data', (entry: string) => entries.push(entry));
Expand Down
4 changes: 2 additions & 2 deletions src/benchmark/suites/regression/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type * as fastGlobCurrent from '../../..';

type GlobImplementation = 'current' | 'previous';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type GlobImplFunction = (...args: any[]) => ReturnType<typeof fastGlobCurrent.stream>;
type GlobImplFunction = (...args: any[]) => ReturnType<typeof fastGlobCurrent.globStream>;
type GlobOptions = fastGlobCurrent.Options;

class Glob {
Expand Down Expand Up @@ -45,7 +45,7 @@ class Glob {
await new Promise<void>((resolve, reject) => {
const stream = function_();

stream.once('error', (error) => {
stream.once('error', (error: Error) => {
reject(error);
});
stream.on('data', (entry: string) => entries.push(entry));
Expand Down
32 changes: 17 additions & 15 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as assert from 'node:assert';

import { describe, it } from 'mocha';

import * as tests from './tests';
import * as fg from '.';

Expand Down Expand Up @@ -57,7 +59,7 @@ describe('Package', () => {

describe('.sync', () => {
it('should be an alias for the .globSync method', () => {
// eslint-disable-next-line import/no-deprecated
// eslint-disable-next-line import/no-deprecated, @typescript-eslint/no-deprecated
assert.strictEqual(fg.sync, fg.globSync);
});
});
Expand Down Expand Up @@ -110,7 +112,7 @@ describe('Package', () => {

describe('.async', () => {
it('should be an alias for the .glob method', () => {
// eslint-disable-next-line import/no-deprecated
// eslint-disable-next-line import/no-deprecated, @typescript-eslint/no-deprecated
assert.strictEqual(fg.async, fg.glob);
});
});
Expand Down Expand Up @@ -177,7 +179,7 @@ describe('Package', () => {

describe('.stream', () => {
it('should be an alias for the .globStream method', () => {
// eslint-disable-next-line import/no-deprecated
// eslint-disable-next-line import/no-deprecated, @typescript-eslint/no-deprecated
assert.strictEqual(fg.stream, fg.globStream);
});
});
Expand Down Expand Up @@ -234,7 +236,7 @@ describe('Package', () => {

describe('.escapePath', () => {
it('should return escaped path', () => {
const expected = 'C:/Program Files \\(x86\\)';
const expected = String.raw`C:/Program Files \(x86\)`;

const actual = fg.escapePath('C:/Program Files (x86)');

Expand All @@ -245,11 +247,11 @@ describe('Package', () => {
describe('.convertPathToPattern', () => {
it('should return a pattern', () => {
// In posix system \\ is a escaping character and it will be escaped before non-special characters.
const posix = 'C:\\\\Program Files \\(x86\\)\\*\\*\\*';
const windows = 'C:/Program Files \\(x86\\)/**/*';
const posix = String.raw`C:\\Program Files \(x86\)\*\*\*`;
const windows = String.raw`C:/Program Files \(x86\)/**/*`;
const expected = tests.platform.isWindows() ? windows : posix;

const actual = fg.convertPathToPattern('C:\\Program Files (x86)\\**\\*');
const actual = fg.convertPathToPattern(String.raw`C:\Program Files (x86)\**\*`);

assert.strictEqual(actual, expected);
});
Expand All @@ -258,19 +260,19 @@ describe('Package', () => {
describe('posix', () => {
describe('.escapePath', () => {
it('should return escaped path', () => {
const expected = '/directory/\\*\\*/\\*';
const expected = String.raw`/directory/\*\*/\*`;

const actual = fg.posix.escapePath('/directory/*\\*/*');
const actual = fg.posix.escapePath(String.raw`/directory/*\*/*`);

assert.strictEqual(actual, expected);
});
});

describe('.convertPathToPattern', () => {
it('should return a pattern', () => {
const expected = 'a\\*.txt';
const expected = String.raw`a\*.txt`;

const actual = fg.posix.convertPathToPattern('a\\*.txt');
const actual = fg.posix.convertPathToPattern(String.raw`a\*.txt`);

assert.strictEqual(actual, expected);
});
Expand All @@ -280,19 +282,19 @@ describe('Package', () => {
describe('win32', () => {
describe('.escapePath', () => {
it('should return escaped path', () => {
const expected = 'C:\\Program Files \\(x86\\)\\**\\*';
const expected = String.raw`C:\Program Files \(x86\)\**\*`;

const actual = fg.win32.escapePath('C:\\Program Files (x86)\\**\\*');
const actual = fg.win32.escapePath(String.raw`C:\Program Files (x86)\**\*`);

assert.strictEqual(actual, expected);
});
});

describe('.convertPathToPattern', () => {
it('should return a pattern', () => {
const expected = 'C:/Program Files \\(x86\\)/**/*';
const expected = String.raw`C:/Program Files \(x86\)/**/*`;

const actual = fg.win32.convertPathToPattern('C:\\Program Files (x86)\\**\\*');
const actual = fg.win32.convertPathToPattern(String.raw`C:\Program Files (x86)\**\*`);

assert.strictEqual(actual, expected);
});
Expand Down
2 changes: 2 additions & 0 deletions src/managers/tasks.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as assert from 'node:assert';

import { describe, it } from 'mocha';

import Settings from '../settings';
import * as tests from '../tests';
import * as manager from './tasks';
Expand Down
1 change: 1 addition & 0 deletions src/providers/async.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as assert from 'node:assert';

import * as sinon from 'sinon';
import { describe, it } from 'mocha';

import Settings from '../settings';
import * as tests from '../tests';
Expand Down
2 changes: 2 additions & 0 deletions src/providers/filters/deep.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as assert from 'node:assert';

import { describe, it } from 'mocha';

import Settings from '../../settings';
import * as tests from '../../tests';
import DeepFilter from './deep';
Expand Down
2 changes: 2 additions & 0 deletions src/providers/filters/entry.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as assert from 'node:assert';
import * as path from 'node:path';

import { describe, it } from 'mocha';

import Settings from '../../settings';
import * as tests from '../../tests';
import EntryFilter from './entry';
Expand Down
2 changes: 2 additions & 0 deletions src/providers/filters/error.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as assert from 'node:assert';

import { describe, it } from 'mocha';

import Settings from '../../settings';
import * as tests from '../../tests';
import ErrorFilter from './error';
Expand Down
2 changes: 2 additions & 0 deletions src/providers/matchers/matcher.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as assert from 'node:assert';

import { describe, it } from 'mocha';

import * as tests from '../../tests';
import Settings from '../../settings';
import Matcher from './matcher';
Expand Down
2 changes: 2 additions & 0 deletions src/providers/matchers/partial.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as assert from 'node:assert';

import { describe, it } from 'mocha';

import Settings from '../../settings';
import Matcher from './partial';

Expand Down
4 changes: 3 additions & 1 deletion src/providers/provider.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as assert from 'node:assert';
import * as path from 'node:path';

import { describe, it } from 'mocha';

import Settings from '../settings';
import * as tests from '../tests';
import { Provider } from './provider';
Expand Down Expand Up @@ -78,7 +80,7 @@ describe('Providers → Provider', () => {
assert.strictEqual(typeof actual.deepFilter, 'function');
assert.strictEqual(typeof actual.entryFilter, 'function');
assert.strictEqual(typeof actual.errorFilter, 'function');
assert.ok(actual.followSymbolicLinks);
assert.strictEqual(actual.followSymbolicLinks, true);
assert.strictEqual(typeof actual.fs, 'object');
assert.ok(!actual.stats);
assert.ok(actual.throwErrorOnBrokenSymbolicLink === false);
Expand Down
1 change: 1 addition & 0 deletions src/providers/stream.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as assert from 'node:assert';
import { PassThrough } from 'node:stream';

import * as sinon from 'sinon';
import { describe, it } from 'mocha';

import Settings from '../settings';
import * as tests from '../tests';
Expand Down
1 change: 1 addition & 0 deletions src/providers/sync.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as assert from 'node:assert';

import * as sinon from 'sinon';
import { describe, it } from 'mocha';

import { ReaderSync } from '../readers';
import Settings from '../settings';
Expand Down
2 changes: 2 additions & 0 deletions src/providers/transformers/entry.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as assert from 'node:assert';
import * as path from 'node:path';

import { describe, it } from 'mocha';

import Settings from '../../settings';
import * as tests from '../../tests';
import EntryTransformer from './entry';
Expand Down
1 change: 1 addition & 0 deletions src/readers/async.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as assert from 'node:assert';
import { PassThrough } from 'node:stream';

import * as sinon from 'sinon';
import { describe, it } from 'mocha';

import Settings from '../settings';
import * as tests from '../tests';
Expand Down
1 change: 1 addition & 0 deletions src/readers/reader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as assert from 'node:assert';
import * as path from 'node:path';

import { Stats, StatsMode } from '@nodelib/fs.macchiato';
import { describe, it } from 'mocha';

import Settings from '../settings';
import { Reader } from './reader';
Expand Down
1 change: 1 addition & 0 deletions src/readers/stream.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as assert from 'node:assert';

import { Stats } from '@nodelib/fs.macchiato';
import * as sinon from 'sinon';
import { describe, it } from 'mocha';

import Settings from '../settings';
import * as tests from '../tests';
Expand Down
1 change: 1 addition & 0 deletions src/readers/sync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as assert from 'node:assert';

import { Stats } from '@nodelib/fs.macchiato';
import * as sinon from 'sinon';
import { describe, it } from 'mocha';

import Settings from '../settings';
import * as tests from '../tests';
Expand Down
2 changes: 2 additions & 0 deletions src/settings.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as assert from 'node:assert';

import { describe, it } from 'mocha';

import Settings, { DEFAULT_FILE_SYSTEM_ADAPTER } from './settings';

describe('Settings', () => {
Expand Down
Loading

0 comments on commit 3e7a83b

Please sign in to comment.