Skip to content

Commit 9fa8724

Browse files
committed
chore: upgrade eslint from v8 to v9
1 parent 7c7f125 commit 9fa8724

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2852
-718
lines changed

.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = {
2828
loader: "style-loader",
2929
options: {
3030
injectType: "styleTag",
31-
styleTagTransform: function (css, style) {
31+
styleTagTransform (css, style) {
3232
// Do something ...
3333
style.innerHTML = `${css}.modify{}\n`;
3434

@@ -50,7 +50,7 @@ After:
5050

5151
```js
5252
function insert(css, style) {
53-
var parent = options.target || document.head;
53+
const parent = options.target || document.head;
5454

5555
parent.appendChild(element);
5656
}
@@ -100,7 +100,7 @@ module.exports = {
100100
loader: "style-loader",
101101
options: {
102102
injectType: "styleTag",
103-
styleTagTransform: function (css, style) {
103+
styleTagTransform (css, style) {
104104
// Do something ...
105105
style.innerHTML = `${css}.modify{}\n`;
106106

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,9 @@ Insert styles at top of `head` tag:
555555

556556
```js
557557
function insertAtTop(element) {
558-
var parent = document.querySelector("head");
559-
// eslint-disable-next-line no-underscore-dangle
560-
var lastInsertedElement = window._lastElementInsertedByStyleLoader;
558+
const parent = document.querySelector("head");
559+
560+
const lastInsertedElement = globalThis._lastElementInsertedByStyleLoader;
561561

562562
if (!lastInsertedElement) {
563563
parent.insertBefore(element, parent.firstChild);
@@ -567,8 +567,7 @@ function insertAtTop(element) {
567567
parent.appendChild(element);
568568
}
569569

570-
// eslint-disable-next-line no-underscore-dangle
571-
window._lastElementInsertedByStyleLoader = element;
570+
globalThis._lastElementInsertedByStyleLoader = element;
572571
}
573572

574573
module.exports = insertAtTop;
@@ -603,7 +602,7 @@ You can pass any parameters to `style.use(options)` and this value will be passe
603602

604603
```js
605604
function insertIntoTarget(element, options) {
606-
var parent = options.target || document.head;
605+
const parent = options.target || document.head;
607606

608607
parent.appendChild(element);
609608
}
@@ -844,6 +843,7 @@ For `development` mode (including `webpack-dev-server`), you can use `style-load
844843

845844
```js
846845
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
846+
847847
const devMode = process.env.NODE_ENV !== "production";
848848

849849
module.exports = {
@@ -860,7 +860,7 @@ module.exports = {
860860
},
861861
],
862862
},
863-
plugins: [].concat(devMode ? [] : [new MiniCssExtractPlugin()]),
863+
plugins: [devMode ? [] : [new MiniCssExtractPlugin()]].flat(),
864864
};
865865
```
866866

@@ -891,7 +891,7 @@ module.exports = {
891891
**index.js**
892892

893893
```js
894-
import { fooBaz, bar, "my-class" as myClass } from "./styles.css";
894+
import { bar, fooBaz, "my-class" as myClass } from "./styles.css";
895895

896896
console.log(fooBaz, bar, myClass);
897897
```
@@ -1073,8 +1073,8 @@ Insert styles at top of `head` tag.
10731073

10741074
```js
10751075
function insertAtTop(element) {
1076-
var parent = document.querySelector("head");
1077-
var lastInsertedElement = window._lastElementInsertedByStyleLoader;
1076+
const parent = document.querySelector("head");
1077+
const lastInsertedElement = globalThis._lastElementInsertedByStyleLoader;
10781078

10791079
if (!lastInsertedElement) {
10801080
parent.insertBefore(element, parent.firstChild);
@@ -1084,7 +1084,7 @@ function insertAtTop(element) {
10841084
parent.appendChild(element);
10851085
}
10861086

1087-
window._lastElementInsertedByStyleLoader = element;
1087+
globalThis._lastElementInsertedByStyleLoader = element;
10881088
}
10891089

10901090
module.exports = insertAtTop;
@@ -1124,7 +1124,7 @@ function insertBeforeAt(element) {
11241124
const parent = document.querySelector("head");
11251125
const target = document.querySelector("#id");
11261126

1127-
const lastInsertedElement = window._lastElementInsertedByStyleLoader;
1127+
const lastInsertedElement = globalThis._lastElementInsertedByStyleLoader;
11281128

11291129
if (!lastInsertedElement) {
11301130
parent.insertBefore(element, target);
@@ -1134,7 +1134,7 @@ function insertBeforeAt(element) {
11341134
parent.appendChild(element);
11351135
}
11361136

1137-
window._lastElementInsertedByStyleLoader = element;
1137+
globalThis._lastElementInsertedByStyleLoader = element;
11381138
}
11391139

11401140
module.exports = insertBeforeAt;
@@ -1171,7 +1171,7 @@ You can define custom target for your styles when using the `lazyStyleTag` type.
11711171

11721172
```js
11731173
function insertIntoTarget(element, options) {
1174-
var parent = options.target || document.head;
1174+
const parent = options.target || document.head;
11751175

11761176
parent.appendChild(element);
11771177
}

eslint.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineConfig } from "eslint/config";
2+
import configs from "eslint-config-webpack/configs.js";
3+
4+
export default defineConfig([
5+
{
6+
extends: [configs["recommended-dirty"]],
7+
},
8+
]);

0 commit comments

Comments
 (0)