Skip to content

Commit ceb0b87

Browse files
committed
Fix lint warnings in standalone package
1 parent d7e7fcb commit ceb0b87

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

standalone/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const getConfig = memoizeOne((ruleSeverityOverrides) => {
3232
if (ruleSeverityOverrides) {
3333
// change severity levels of rules based on rules: Record<string, 0 | 1 | 2> arg
3434
Object.keys(ruleSeverityOverrides).forEach((key) => {
35-
if (config.rules.hasOwnProperty(key)) {
35+
if (Object.prototype.hasOwnProperty.call(config.rules, key)) {
3636
if (Array.isArray(config.rules[key])) {
3737
config.rules[key] = [ruleSeverityOverrides[key], ...config.rules[key].slice(1)];
3838
} else {

standalone/mock/path.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function normalizeArray(parts, allowAboveRoot) {
5151

5252
// Split a filename into [root, dir, basename, ext], unix version
5353
// 'root' is just a slash, or nothing.
54-
const splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
54+
const splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;
5555
const splitPath = function (filename) {
5656
return splitPathRe.exec(filename).slice(1);
5757
};
@@ -123,7 +123,7 @@ export function isAbsolute(path) {
123123
export function join() {
124124
const paths = Array.prototype.slice.call(arguments, 0);
125125
return normalize(
126-
filter(paths, function (p, index) {
126+
filter(paths, (p) => {
127127
if (typeof p !== "string") {
128128
throw new TypeError("Arguments to path.join must be strings");
129129
}
@@ -165,7 +165,7 @@ export function relative(from, to) {
165165
}
166166
}
167167

168-
const outputParts = [];
168+
let outputParts = [];
169169
for (let i = samePartsLength; i < fromParts.length; i++) {
170170
outputParts.push("..");
171171
}

standalone/rollup-plugin-replace.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// lifted from @typescript-eslint/website-eslint/rollup-plugin/replace.js
2-
const path = require("path");
3-
const Module = require("module");
4-
const rollupPluginUtils = require("@rollup/pluginutils");
5-
const MagicString = require("magic-string");
2+
import path from "path";
3+
import Module from "module";
4+
import { createFilter } from "@rollup/pluginutils";
5+
import MagicString from "magic-string";
66

77
function toAbsolute(id) {
88
return id.startsWith("./") ? path.resolve(id) : require.resolve(id);
@@ -18,11 +18,11 @@ function createMatcher(it) {
1818
if (typeof it === "function") {
1919
return it;
2020
} else {
21-
return rollupPluginUtils.createFilter(it);
21+
return createFilter(it);
2222
}
2323
}
2424

25-
module.exports = (options = {}) => {
25+
export default (options = {}) => {
2626
const aliasesCache = new Map();
2727
const aliases = (options.alias || []).map((item) => {
2828
return {

standalone/rollup.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import commonjs from "@rollup/plugin-commonjs";
33
import json from "@rollup/plugin-json";
44
import resolve from "@rollup/plugin-node-resolve";
55

6-
const replace = require("./rollup-plugin-replace");
6+
import replace from "./rollup-plugin-replace";
77

88
module.exports = {
99
input: "index.js",
@@ -113,6 +113,10 @@ module.exports = {
113113
test: /process\.env\.IGNORE_TEST_WIN32/u,
114114
replace: "true",
115115
},
116+
{
117+
test: /process.cwd\(\)/u,
118+
replace: "'~'",
119+
},
116120
{
117121
test: /__filename/u,
118122
replace: "''",

0 commit comments

Comments
 (0)