mirror of
https://github.com/cheeriojs/cheerio.git
synced 2026-02-25 23:25:17 +00:00
chore(lint): Use shared eslint config
This commit is contained in:
@@ -5,7 +5,6 @@ import { commonTypeScriptRules } from '@feedic/eslint-config/typescript';
|
||||
import eslintPluginVitest from '@vitest/eslint-plugin';
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
import eslintPluginJsdoc from 'eslint-plugin-jsdoc';
|
||||
import globals from 'globals';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
@@ -25,22 +24,12 @@ export default defineConfig(
|
||||
...feedicFlatConfig,
|
||||
|
||||
{
|
||||
// JSDoc configuration
|
||||
plugins: { jsdoc: eslintPluginJsdoc },
|
||||
rules: {
|
||||
...eslintPluginJsdoc.configs.recommended.rules,
|
||||
'jsdoc/require-jsdoc': 0,
|
||||
'jsdoc/tag-lines': [2, 'any', { startLines: 1 }],
|
||||
'jsdoc/require-param-type': 0,
|
||||
'jsdoc/require-returns-type': 0,
|
||||
'jsdoc/no-types': 2,
|
||||
'jsdoc/require-returns-check': 0, // Was in TS override, better here
|
||||
},
|
||||
settings: {
|
||||
jsdoc: {
|
||||
mode: 'typescript',
|
||||
tagNamePreference: { category: 'category' },
|
||||
},
|
||||
'jsdoc/require-returns-check': 0,
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
10
package-lock.json
generated
10
package-lock.json
generated
@@ -24,7 +24,7 @@
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.4.4",
|
||||
"@eslint/compat": "^2.0.2",
|
||||
"@feedic/eslint-config": "^0.1.0",
|
||||
"@feedic/eslint-config": "^0.2.2",
|
||||
"@imgix/js-core": "^3.8.0",
|
||||
"@octokit/graphql": "^9.0.3",
|
||||
"@types/jsdom": "^27.0.0",
|
||||
@@ -34,7 +34,6 @@
|
||||
"@vitest/eslint-plugin": "^1.6.9",
|
||||
"eslint": "^10.0.1",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-jsdoc": "^62.7.0",
|
||||
"globals": "^17.3.0",
|
||||
"husky": "^9.1.7",
|
||||
"jquery": "^4.0.0",
|
||||
@@ -1135,13 +1134,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@feedic/eslint-config": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@feedic/eslint-config/-/eslint-config-0.1.0.tgz",
|
||||
"integrity": "sha512-SqqnkmqRSrS43G/wYq7cjem7n14lBc91vMk3j7XHpp+gwkYV1gymkNNxzAkhynBDKHGzUgpBVeKz4BkuiUAOmQ==",
|
||||
"version": "0.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@feedic/eslint-config/-/eslint-config-0.2.2.tgz",
|
||||
"integrity": "sha512-JI3qkrabQ2KID8dcHvt+3WOwiOXG0UgNTcj0xOpvY6kmx/mQN8I3WmZQGR5szpWLFukjDMbgfWS4seeE+To6IA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"eslint-plugin-jsdoc": "^62.7.0",
|
||||
"eslint-plugin-n": "^17.24.0",
|
||||
"eslint-plugin-package-json": "^0.89.0",
|
||||
"eslint-plugin-unicorn": "^63.0.0",
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^2.4.4",
|
||||
"@eslint/compat": "^2.0.2",
|
||||
"@feedic/eslint-config": "^0.1.0",
|
||||
"@feedic/eslint-config": "^0.2.2",
|
||||
"@imgix/js-core": "^3.8.0",
|
||||
"@octokit/graphql": "^9.0.3",
|
||||
"@types/jsdom": "^27.0.0",
|
||||
@@ -135,7 +135,6 @@
|
||||
"@vitest/eslint-plugin": "^1.6.9",
|
||||
"eslint": "^10.0.1",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-jsdoc": "^62.7.0",
|
||||
"globals": "^17.3.0",
|
||||
"husky": "^9.1.7",
|
||||
"jquery": "^4.0.0",
|
||||
|
||||
@@ -16,6 +16,7 @@ interface ExtractDescriptor {
|
||||
|
||||
type ExtractValue = string | ExtractDescriptor | [string | ExtractDescriptor];
|
||||
|
||||
/** Descriptor map used by {@link extract}. */
|
||||
export type ExtractMap = Record<string, ExtractValue>;
|
||||
|
||||
type ExtractedValue<V extends ExtractValue> = V extends [
|
||||
@@ -34,6 +35,7 @@ type ExtractedValue<V extends ExtractValue> = V extends [
|
||||
: never
|
||||
: never;
|
||||
|
||||
/** Result type computed from an {@link ExtractMap}. */
|
||||
export type ExtractedMap<M extends ExtractMap> = {
|
||||
[key in keyof M]: ExtractedValue<M[key]>;
|
||||
};
|
||||
|
||||
@@ -784,6 +784,14 @@ export function filter<T>(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter an array of nodes with either a selector or predicate.
|
||||
*
|
||||
* @param nodes - The nodes to filter.
|
||||
* @param match - Selector or predicate used to keep nodes.
|
||||
* @param xmlMode - Whether selector matching should use XML mode.
|
||||
* @param root - Optional document root used for selector matching.
|
||||
*/
|
||||
export function filterArray<T>(
|
||||
nodes: T[],
|
||||
match: AcceptedFilters<T>,
|
||||
|
||||
@@ -114,6 +114,7 @@ export abstract class Cheerio<T> implements ArrayLike<T> {
|
||||
abstract _render(dom: AnyNode | ArrayLike<AnyNode>): string;
|
||||
}
|
||||
|
||||
/** Public Cheerio collection interface exposed by the module. */
|
||||
export interface Cheerio<T> extends MethodsType, Iterable<T> {
|
||||
cheerio: '[cheerio object]';
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@ export function stringStream(
|
||||
return _stringStream(flattenOptions(options), cb);
|
||||
}
|
||||
|
||||
/** Options used by {@link decodeStream} for decoding incoming buffers. */
|
||||
export interface DecodeStreamOptions extends CheerioOptions {
|
||||
encoding?: SnifferOptions;
|
||||
}
|
||||
@@ -184,6 +185,7 @@ type UndiciStreamOptions = Omit<
|
||||
'path'
|
||||
>;
|
||||
|
||||
/** Options accepted by {@link fromURL}. */
|
||||
export interface CheerioRequestOptions extends DecodeStreamOptions {
|
||||
/** The options passed to `undici`'s `stream` method. */
|
||||
requestOptions?: UndiciStreamOptions;
|
||||
|
||||
@@ -106,6 +106,12 @@ export interface CheerioAPI extends StaticType {
|
||||
load: ReturnType<typeof getLoad>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a loader factory from parser and renderer implementations.
|
||||
*
|
||||
* @param parse - Parser used to convert input into a document.
|
||||
* @param render - Renderer used to serialize nodes back to markup.
|
||||
*/
|
||||
export function getLoad(
|
||||
parse: Cheerio<AnyNode>['_parse'],
|
||||
render: (
|
||||
|
||||
Reference in New Issue
Block a user