UNPKG

1.88 kBMarkdownView Raw
1# eslint-plugin-tsdoc
2
3This ESLint plugin provides a rule for validating that TypeScript doc comments conform to the
4[TSDoc specification](https://tsdoc.org/).
5
6## Usage
7
81. Configure ESLint for your TypeScript project. See the instructions provided by the
9 [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) project.
10 You will end up with some dependencies like this:
11
12 **my-project/package.json** (example)
13 ```ts
14 {
15 "name": "my-project",
16 "version": "1.0.0",
17 "dependencies": {},
18 "devDependencies": {
19 "@typescript-eslint/eslint-plugin": "~2.6.1",
20 "@typescript-eslint/parser": "~2.6.1",
21 "eslint": "~6.6.0",
22 "typescript": "~3.7.2"
23 },
24 "scripts": {
25 "lint": "eslint -f unix \"src/**/*.{ts,tsx}\""
26 }
27 }
28 ```
29
302. Add the `eslint-plugin-tsdoc` dependency to your project:
31
32 ```bash
33 $ cd my-project
34 $ npm install --save-dev eslint-plugin-tsdoc
35 ```
36
373. In your ESLint config file, add the `"eslint-plugin-tsdoc"` package to your `plugins` field,
38 and enable the `"tsdoc/syntax"` rule. For example:
39
40 **my-project/.eslintrc.js** (example)
41 ```ts
42 module.exports = {
43 plugins: [
44 "@typescript-eslint/eslint-plugin",
45 "eslint-plugin-tsdoc"
46 ],
47 extends: [
48 'plugin:@typescript-eslint/recommended'
49 ],
50 parser: '@typescript-eslint/parser',
51 parserOptions: {
52 project: "./tsconfig.json",
53 tsconfigRootDir: __dirname,
54 ecmaVersion: 2018,
55 sourceType: "module"
56 },
57 rules: {
58 "tsdoc/syntax": "warn"
59 }
60 };
61 ```
62
63This package is maintained by the TSDoc project. If you have questions or feedback, please
64[let us know](https://tsdoc.org/pages/resources/help)!