Skip to content

Commit 49d7d0a

Browse files
authored
chore: upgrade eslint from v8 to v9 (#646)
1 parent 7c7f125 commit 49d7d0a

46 files changed

Lines changed: 2862 additions & 720 deletions

Some content is hidden

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

.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: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,13 @@ Insert styles at top of `head` tag:
553553

554554
**insert-function.js**
555555

556+
<!-- eslint-disable -->
557+
556558
```js
557559
function insertAtTop(element) {
558-
var parent = document.querySelector("head");
559-
// eslint-disable-next-line no-underscore-dangle
560-
var lastInsertedElement = window._lastElementInsertedByStyleLoader;
560+
const parent = document.querySelector("head");
561+
562+
const lastInsertedElement = window._lastElementInsertedByStyleLoader;
561563

562564
if (!lastInsertedElement) {
563565
parent.insertBefore(element, parent.firstChild);
@@ -567,7 +569,6 @@ function insertAtTop(element) {
567569
parent.appendChild(element);
568570
}
569571

570-
// eslint-disable-next-line no-underscore-dangle
571572
window._lastElementInsertedByStyleLoader = element;
572573
}
573574

@@ -603,7 +604,7 @@ You can pass any parameters to `style.use(options)` and this value will be passe
603604

604605
```js
605606
function insertIntoTarget(element, options) {
606-
var parent = options.target || document.head;
607+
const parent = options.target || document.head;
607608

608609
parent.appendChild(element);
609610
}
@@ -844,6 +845,7 @@ For `development` mode (including `webpack-dev-server`), you can use `style-load
844845

845846
```js
846847
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
848+
847849
const devMode = process.env.NODE_ENV !== "production";
848850

849851
module.exports = {
@@ -860,7 +862,7 @@ module.exports = {
860862
},
861863
],
862864
},
863-
plugins: [].concat(devMode ? [] : [new MiniCssExtractPlugin()]),
865+
plugins: [devMode ? [] : [new MiniCssExtractPlugin()]].flat(),
864866
};
865867
```
866868

@@ -891,7 +893,7 @@ module.exports = {
891893
**index.js**
892894

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

896898
console.log(fooBaz, bar, myClass);
897899
```
@@ -1071,10 +1073,12 @@ Insert styles at top of `head` tag.
10711073

10721074
**insert-function.js**
10731075

1076+
<!-- eslint-disable -->
1077+
10741078
```js
10751079
function insertAtTop(element) {
1076-
var parent = document.querySelector("head");
1077-
var lastInsertedElement = window._lastElementInsertedByStyleLoader;
1080+
const parent = document.querySelector("head");
1081+
const lastInsertedElement = window._lastElementInsertedByStyleLoader;
10781082

10791083
if (!lastInsertedElement) {
10801084
parent.insertBefore(element, parent.firstChild);
@@ -1119,6 +1123,8 @@ Inserts styles before `#id` element.
11191123

11201124
**insert-function.js**
11211125

1126+
<!-- eslint-disable -->
1127+
11221128
```js
11231129
function insertBeforeAt(element) {
11241130
const parent = document.querySelector("head");
@@ -1171,7 +1177,7 @@ You can define custom target for your styles when using the `lazyStyleTag` type.
11711177

11721178
```js
11731179
function insertIntoTarget(element, options) {
1174-
var parent = options.target || document.head;
1180+
const parent = options.target || document.head;
11751181

11761182
parent.appendChild(element);
11771183
}

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)