Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions .eslintrc.yml

This file was deleted.

50 changes: 50 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import js from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';
import globals from 'globals';

export default [
js.configs.recommended,
{
files: ['lib/**/*.js', 'index.mjs'],
plugins: {
'@stylistic': stylistic
},
languageOptions: {
ecmaVersion: 2020,
sourceType: 'module',
globals: {
...globals.node,
...globals.mocha
}
},
rules: {
'consistent-return': 'error',
'curly': 'error',
'default-case': 'error',
'dot-notation': 'error',
'eqeqeq': 'error',
'no-extend-native': 'error',
'no-implicit-coercion': 'error',
'no-loop-func': 'error',
'no-throw-literal': 'error',
'camelcase': 'error',
'consistent-this': ['error', 'self'],
'func-names': 'warn',
'no-console': 'error',

'@stylistic/no-multi-spaces': 'error',
'@stylistic/brace-style': ['error', '1tbs', {allowSingleLine: true}],
'@stylistic/indent': ['error', 'tab', {SwitchCase: 1}],
'@stylistic/linebreak-style': ['error', 'unix'],
'@stylistic/eol-last': 'error',
'@stylistic/quotes': ['error', 'single'],
'@stylistic/semi': 'error',
'@stylistic/space-infix-ops': 'error',
'@stylistic/space-unary-ops': 'error',
'@stylistic/space-before-function-paren': 'warn',
'@stylistic/function-call-spacing': ['warn', 'never'],
'@stylistic/keyword-spacing': 'error',
'@stylistic/space-before-blocks': 'error'
}
}
];
3 changes: 1 addition & 2 deletions lib/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ class Resource {

createChild (url, filename) {
const child = new Resource(url, filename);
let currentDepth = this.getDepth();

child.parent = this;
child.depth = ++currentDepth;
child.depth = this.getDepth() + 1;

this.children.push(child);

Expand Down
4 changes: 2 additions & 2 deletions lib/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function getPathnameFromUrl (u) {
const pathname = url.parse(u).pathname;
try {
return decodeURI(pathname);
} catch (e) {
} catch {
return pathname;
}
}
Expand Down Expand Up @@ -110,7 +110,7 @@ function sanitizeFilename (filename) {
function normalizeUrl (u, opts) {
try {
return normalize(u, extend({removeTrailingSlash: false, stripHash: true}, opts));
} catch (e) {
} catch {
return u;
}
}
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"test": "c8 --all --reporter=text --reporter=lcov mocha --recursive --timeout 7000 ./test/unit/ ./test/functional",
"test-e2e": "mocha --timeout 300000 ./test/e2e/*-test.js",
"eslint": "eslint lib/** index.mjs"
"eslint": "eslint lib index.mjs"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,9 +48,12 @@
"srcset": "^5.0.0"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@stylistic/eslint-plugin": "^5.10.0",
"c8": "^11.0.0",
"chai": "^6.2.0",
"eslint": "^8.5.0",
"eslint": "^10.5.0",
"globals": "^17.7.0",
"mocha": "^11.0.1",
"nock": "^14.0.0",
"sinon": "^21.0.0"
Expand Down