Skip to content

Commit

Permalink
chore: Update deprecated default export of cheerio
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed May 15, 2024
1 parent 3ce8e62 commit 186a6a8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dependencies": {
"ansi-regex": "^6.0.1",
"chalk": "^5.0.0",
"cheerio": "^1.0.0-rc.6",
"cheerio": "^1.0.0-rc.9",
"fast-xml-parser": "^4.2.4",
"glob": "^7.1.2",
"htmlparser2": "^3.9.1",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/linting.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {EventEmitter} from 'node:events';
import path from 'node:path';
import process from 'node:process';
import cheerio from 'cheerio';
import * as cheerio from 'cheerio';
import logging from './logger.js';
import * as parse from './parse.js';
import Reporter from './reporter.js';
Expand Down Expand Up @@ -86,7 +86,7 @@ class Linting extends EventEmitter {
// Start every rule
for (const ruleName of ruleNames) {
const ast = parse.clone(this.ast);
const cheerioParsed = cheerio
const $ = cheerio
.load('<root></root>', {xmlMode: true})('root')
// @ts-ignore
.append(ast);
Expand All @@ -103,7 +103,7 @@ class Linting extends EventEmitter {
// also handles catching errors from the rule
Promise.resolve()
.then(() =>
rule(reporter, cheerioParsed, ast, {
rule(reporter, $, ast, {
filepath: this.path,
}),
)
Expand Down
1 change: 1 addition & 0 deletions src/rules/elm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import logging from '../lib/logger.js';

const logger = logging('rule:elm');

/** @typedef {import('cheerio').Cheerio<import('domhandler').Document>} Cheerio */
/** @typedef {import("../lib/reporter.js")} Reporter */
/** @typedef {import("../lib/parse.js").AST} AST */
/** @typedef {import("../lib/parse.js").Node} Node */
Expand Down
1 change: 1 addition & 0 deletions src/rules/valid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import logging from '../lib/logger.js';

const logger = logging('rule:valid');

/** @typedef {import('cheerio').Cheerio<import('domhandler').Document>} Cheerio */
/** @typedef {import("../lib/reporter.js")} Reporter */
/** @typedef {import("../lib/parse.js").AST} AST */
/** @typedef {import("../lib/parse.js").Node} Node */
Expand Down

0 comments on commit 186a6a8

Please sign in to comment.