Skip to content

Commit

Permalink
refactor: Convert to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 committed Apr 19, 2021
1 parent b2c74a1 commit 15421df
Show file tree
Hide file tree
Showing 36 changed files with 4,081 additions and 3,994 deletions.
13 changes: 6 additions & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"allowImplicit": true
}
],
"block-scoped-var": 2,
"no-lonely-if": 2,
"no-proto": 2,
"eqeqeq": [2, "smart"],
Expand Down Expand Up @@ -48,7 +47,6 @@
"no-useless-call": 2,
"no-use-before-define": [2, "nofunc"],
"no-void": 2,
"strict": 2,

"jsdoc/require-jsdoc": 0,
"jsdoc/check-param-names": 0,
Expand All @@ -62,17 +60,18 @@
"jsdoc/require-param-type": 0,
"jsdoc/require-returns-type": 0,
"jsdoc/require-param": 0,
"jsdoc/no-types": 2,
"jsdoc/valid-types": 2,

"node/no-unsupported-features/es-syntax": 0,
"node/no-missing-import": [
2,
{ "tryExtensions": [".js", ".json", ".node", ".ts"] }
]
"node/no-missing-import": [2, { "tryExtensions": [".js", ".json", ".ts"] }]
},
"settings": {
"jsdoc": {
"mode": "typescript"
"mode": "typescript",
"tagNamePreference": {
"category": "category"
}
}
},
"overrides": [
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ jobs:

- name: Run lint
run: npm run lint

- name: Test types
run: npm run test:types
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ node_modules
npm-debug.log
.DS_Store
/.netlify/
/coverage/
/docs/
/coverage
/docs
/lib
14 changes: 8 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
<a href="https://coveralls.io/github/cheeriojs/cheerio">
<img src="https://img.shields.io/coveralls/github/cheeriojs/cheerio/main" alt="Coverage">
</a>
<a href="https://gitter.im/cheeriojs/cheerio">
<img src="https://img.shields.io/gitter/room/cheeriojs/cheerio?color=%2348b293" alt="Join the chat at https://gitter.im/cheeriojs/cheerio">
</a>
<a href="#backers">
<img src="https://img.shields.io/opencollective/backers/cheerio" alt="OpenCollective backers">
</a>
Expand Down Expand Up @@ -79,7 +76,12 @@ First you need to load in the HTML. This step in jQuery is implicit, since jQuer
This is the _preferred_ method:

```js
// ES6 or TypeScript:
import * as cheerio from 'cheerio';

// In other environments:
const cheerio = require('cheerio');

const $ = cheerio.load('<ul id="fruits">...</ul>');

$.html();
Expand Down Expand Up @@ -131,7 +133,7 @@ The options in the `xml` object are taken directly from [htmlparser2](https://gi
}
```

For a full list of options and their effects, see [this](https://github.com/fb55/DomHandler) and
For a full list of options and their effects, see [domhandler](https://github.com/fb55/DomHandler) and
[htmlparser2's options](https://github.com/fb55/htmlparser2/wiki/Parser-options).

Some users may wish to parse markup with the `htmlparser2` library, and
Expand All @@ -149,9 +151,9 @@ structure as its first argument. Users may install `htmlparser2`, use it to
parse input, and pass the result to `load`:

```js
// Usage as of htmlparser2 version 3:
// Usage as of htmlparser2 version 6:
const htmlparser2 = require('htmlparser2');
const dom = htmlparser2.parseDOM(document, options);
const dom = htmlparser2.parseDocument(document, options);

const $ = cheerio.load(dom);
```
Expand Down

0 comments on commit 15421df

Please sign in to comment.