Skip to content

Commit 57cbaae

Browse files
Merge pull request #19916 from Snuffleupagus/prefer-import-meta-properties
Enable the `unicorn/prefer-import-meta-properties` ESLint plugin rule
2 parents d97b653 + 13c9995 commit 57cbaae

9 files changed

Lines changed: 16 additions & 152 deletions

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export default [
145145
"unicorn/prefer-date-now": "error",
146146
"unicorn/prefer-dom-node-append": "error",
147147
"unicorn/prefer-dom-node-remove": "error",
148+
"unicorn/prefer-import-meta-properties": "error",
148149
"unicorn/prefer-includes": "error",
149150
"unicorn/prefer-logical-operator-over-ternary": "error",
150151
"unicorn/prefer-modern-dom-apis": "error",

external/builder/test-fixtures.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import * as builder from "./builder.mjs";
2-
import { fileURLToPath } from "url";
32
import fs from "fs";
43
import path from "path";
54

6-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
5+
const __dirname = import.meta.dirname;
76

87
let errors = 0;
98

external/builder/test-fixtures_babel.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { fileURLToPath } from "url";
21
import fs from "fs";
32
import path from "path";
43
import { preprocessPDFJSCode } from "./babel-plugin-pdfjs-preprocessor.mjs";
54

6-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
5+
const __dirname = import.meta.dirname;
76

87
let errors = 0;
98

gulpfile.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { exec, execSync, spawn, spawnSync } from "child_process";
2121
import autoprefixer from "autoprefixer";
2222
import babel from "@babel/core";
2323
import crypto from "crypto";
24-
import { fileURLToPath } from "url";
2524
import fs from "fs";
2625
import gulp from "gulp";
2726
import hljs from "highlight.js";
@@ -46,7 +45,7 @@ import webpack2 from "webpack";
4645
import webpackStream from "webpack-stream";
4746
import zip from "gulp-zip";
4847

49-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
48+
const __dirname = import.meta.dirname;
5049

5150
const BUILD_DIR = "build/";
5251
const L10N_DIR = "l10n/";

package-lock.json

Lines changed: 8 additions & 138 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"eslint-plugin-no-unsanitized": "^4.1.2",
2424
"eslint-plugin-perfectionist": "^4.12.3",
2525
"eslint-plugin-prettier": "^5.2.6",
26-
"eslint-plugin-unicorn": "^58.0.0",
26+
"eslint-plugin-unicorn": "^59.0.1",
2727
"globals": "^16.0.0",
2828
"gulp": "^5.0.0",
2929
"gulp-cli": "^3.0.0",

test/integration/highlight_editor_spec.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ import {
4141
waitForSerialized,
4242
waitForTimeout,
4343
} from "./test_utils.mjs";
44-
import { fileURLToPath } from "url";
4544
import fs from "fs";
4645
import path from "path";
4746

48-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
47+
const __dirname = import.meta.dirname;
4948

5049
const selectAll = selectEditors.bind(null, "highlight");
5150

test/integration/signature_editor_spec.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ import {
2727
waitForPointerUp,
2828
waitForTimeout,
2929
} from "./test_utils.mjs";
30-
31-
import { fileURLToPath } from "url";
3230
import fs from "fs";
3331
import path from "path";
3432
import { PNG } from "pngjs";
3533

36-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
34+
const __dirname = import.meta.dirname;
3735

3836
const switchToSignature = switchToEditor.bind(null, "Signature");
3937

test/integration/stamp_editor_spec.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ import {
4949
waitForSerialized,
5050
waitForTimeout,
5151
} from "./test_utils.mjs";
52-
import { fileURLToPath } from "url";
5352
import fs from "fs";
5453
import path from "path";
5554
import { PNG } from "pngjs";
5655

57-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
56+
const __dirname = import.meta.dirname;
5857

5958
const clearAll = clearEditors.bind(null, "stamp");
6059

0 commit comments

Comments
 (0)