Skip to content

Commit de1360f

Browse files
chore: update eslint
1 parent 93438a2 commit de1360f

24 files changed

+166
-187
lines changed

.eslintignore

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

.eslintrc.js

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

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,10 @@ module.exports = {
402402
const relativePath = path.relative(rootContext, resourcePath);
403403

404404
if (relativePath === "styles/foo.styl") {
405-
return "value = 100px" + content;
405+
return `value = 100px${content}`;
406406
}
407407

408-
return "value = 200px" + content;
408+
return `value = 200px${content}`;
409409
},
410410
},
411411
},
@@ -436,10 +436,10 @@ module.exports = {
436436
const relativePath = path.relative(rootContext, resourcePath);
437437

438438
if (relativePath === "styles/foo.styl") {
439-
return "value = 100px" + content;
439+
return `value = 100px${content}`;
440440
}
441441

442-
return "value = 200px" + content;
442+
return `value = 200px${content}`;
443443
},
444444
},
445445
},

bench/fixtures/imports/webpack.config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ module.exports = {
1111
test: /\.styl$/,
1212
use: [
1313
{
14-
loader: require("path").join(__dirname, "./testLoader.js"),
14+
loader: require("node:path").join(__dirname, "./testLoader.js"),
1515
},
1616
{
17-
loader: require("path").join(__dirname, "../../../dist/cjs.js"),
17+
loader: require("node:path").join(
18+
__dirname,
19+
"../../../dist/cjs.js",
20+
),
1821
options: {},
1922
},
2023
],

bench/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
const fs = require("fs");
2-
const path = require("path");
1+
const fs = require("node:fs");
2+
const path = require("node:path");
33

4-
// eslint-disable-next-line import/no-extraneous-dependencies
54
const Benchmark = require("benchmark");
6-
// eslint-disable-next-line import/no-extraneous-dependencies
5+
76
const MemoryFileSystem = require("memory-fs");
87
const stylus = require("stylus");
98
const webpack = require("webpack");

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+
]);

package.json

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22
"name": "stylus-loader",
33
"version": "8.1.1",
44
"description": "Stylus loader for webpack",
5-
"license": "MIT",
6-
"repository": "webpack-contrib/stylus-loader",
7-
"author": "Kyle Robinson Young <[email protected]> (http://dontkry.com)",
5+
"keywords": [
6+
"webpack",
7+
"loader",
8+
"stylus"
9+
],
810
"homepage": "https://github.com/webpack-contrib/stylus-loader",
911
"bugs": "https://github.com/webpack-contrib/stylus-loader/issues",
12+
"repository": "webpack-contrib/stylus-loader",
1013
"funding": {
1114
"type": "opencollective",
1215
"url": "https://opencollective.com/webpack"
1316
},
17+
"license": "MIT",
18+
"author": "Kyle Robinson Young <[email protected]> (http://dontkry.com)",
1419
"main": "dist/cjs.js",
15-
"engines": {
16-
"node": ">= 18.12.0"
17-
},
20+
"files": [
21+
"dist"
22+
],
1823
"scripts": {
1924
"start": "npm run build -- -w",
2025
"clean": "del-cli dist",
@@ -23,12 +28,12 @@
2328
"commitlint": "commitlint --from=master",
2429
"security": "npm audit --production",
2530
"lint:prettier": "prettier --cache --list-different .",
26-
"lint:js": "eslint --cache .",
31+
"lint:code": "eslint --cache .",
2732
"lint:spelling": "cspell --cache --no-must-find-files --quiet \"**/*.*\"",
2833
"lint": "npm-run-all -l -p \"lint:**\"",
29-
"fix:js": "npm run lint:js -- --fix",
34+
"fix:code": "npm run lint:code -- --fix",
3035
"fix:prettier": "npm run lint:prettier -- --write",
31-
"fix": "npm-run-all -l fix:js fix:prettier",
36+
"fix": "npm-run-all -l fix:code fix:prettier",
3237
"test:only": "cross-env NODE_ENV=test jest",
3338
"test:watch": "npm run test:only -- --watch",
3439
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
@@ -37,22 +42,6 @@
3742
"prepare": "husky && npm run build",
3843
"release": "standard-version"
3944
},
40-
"files": [
41-
"dist"
42-
],
43-
"peerDependencies": {
44-
"@rspack/core": "0.x || 1.x",
45-
"stylus": ">=0.52.4",
46-
"webpack": "^5.0.0"
47-
},
48-
"peerDependenciesMeta": {
49-
"@rspack/core": {
50-
"optional": true
51-
},
52-
"webpack": {
53-
"optional": true
54-
}
55-
},
5645
"dependencies": {
5746
"fast-glob": "^3.3.2",
5847
"normalize-path": "^3.0.0"
@@ -64,6 +53,9 @@
6453
"@babel/preset-env": "^7.24.7",
6554
"@commitlint/cli": "^19.8.1",
6655
"@commitlint/config-conventional": "^19.8.1",
56+
"@eslint/js": "^9.32.0",
57+
"@eslint/markdown": "^7.0.0",
58+
"@stylistic/eslint-plugin": "^5.2.2",
6759
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
6860
"babel-jest": "^30.0.0",
6961
"benchmark": "^2.1.4",
@@ -73,9 +65,16 @@
7365
"css-loader": "^7.1.2",
7466
"del": "^7.1.0",
7567
"del-cli": "^5.1.0",
76-
"eslint": "^8.57.0",
77-
"eslint-config-prettier": "^9.1.0",
78-
"eslint-plugin-import": "^2.29.1",
68+
"eslint": "^9.32.0",
69+
"eslint-config-prettier": "^10.1.8",
70+
"eslint-config-webpack": "^4.4.2",
71+
"eslint-plugin-import": "^2.32.0",
72+
"eslint-plugin-jest": "^29.0.1",
73+
"eslint-plugin-jsdoc": "^51.4.1",
74+
"eslint-plugin-n": "^17.21.0",
75+
"eslint-plugin-prettier": "^5.5.3",
76+
"eslint-plugin-unicorn": "^60.0.0",
77+
"globals": "^16.3.0",
7978
"husky": "^9.1.3",
8079
"jest": "^30.0.0",
8180
"lint-staged": "^15.2.7",
@@ -87,11 +86,23 @@
8786
"standard-version": "^9.3.2",
8887
"style-loader": "^4.0.0",
8988
"stylus": "^0.64.0",
89+
"typescript-eslint": "^8.38.0",
9090
"webpack": "^5.101.0"
9191
},
92-
"keywords": [
93-
"webpack",
94-
"loader",
95-
"stylus"
96-
]
92+
"peerDependencies": {
93+
"@rspack/core": "0.x || 1.x",
94+
"stylus": ">=0.52.4",
95+
"webpack": "^5.0.0"
96+
},
97+
"peerDependenciesMeta": {
98+
"@rspack/core": {
99+
"optional": true
100+
},
101+
"webpack": {
102+
"optional": true
103+
}
104+
},
105+
"engines": {
106+
"node": ">= 18.12.0"
107+
}
97108
}

src/index.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import path from "path";
1+
import path from "node:path";
22

33
import schema from "./options.json";
44
import {
5-
getStylusOptions,
65
createEvaluator,
7-
urlResolver,
8-
readFile,
9-
normalizeSourceMap,
106
getStylusImplementation,
7+
getStylusOptions,
8+
normalizeSourceMap,
9+
readFile,
10+
urlResolver,
1111
} from "./utils";
1212

1313
export default async function stylusLoader(source) {
@@ -137,9 +137,7 @@ export default async function stylusLoader(source) {
137137
return;
138138
}
139139

140-
// eslint-disable-next-line no-underscore-dangle
141140
if (stylusOptions._imports.length > 0) {
142-
// eslint-disable-next-line no-underscore-dangle
143141
for (const importData of stylusOptions._imports) {
144142
if (path.isAbsolute(importData.path)) {
145143
this.addDependency(path.normalize(importData.path));
@@ -160,8 +158,8 @@ export default async function stylusLoader(source) {
160158
(await readFile(this.fs, file)).toString(),
161159
),
162160
);
163-
} catch (fsError) {
164-
callback(fsError);
161+
} catch (err) {
162+
callback(err);
165163

166164
return;
167165
}

0 commit comments

Comments
 (0)