@es-joy/jsdoccomment
Advanced tools
Comparing version 0.6.0 to 0.7.0
# CHANGES for `@es-joy/jsdoccomment` | ||
## 0.7.0 | ||
- Enhancement: Allow specifying `noNames` and `noTypes` on `parseComment` | ||
to override (or add to) tags which should have no names or types. | ||
- Enhancement: Export `hasSeeWithLink` utility and `defaultNoTypes` and | ||
`defaultNoNames`. | ||
## 0.6.0 | ||
@@ -4,0 +11,0 @@ |
155
package.json
{ | ||
"name": "@es-joy/jsdoccomment", | ||
"version": "0.6.0", | ||
"author": "Brett Zamir <brettz9@yahoo.com>", | ||
"contributors": [], | ||
"description": "Maintained replacement for ESLint's deprecated SourceCode#getJSDocComment", | ||
"license": "MIT", | ||
"keywords": [ | ||
"eslint", | ||
"sourcecode" | ||
], | ||
"type": "module", | ||
"main": "./dist/index.cjs.cjs", | ||
"exports": { | ||
"require": "./dist/index.cjs.cjs", | ||
"import": "./src/index.js" | ||
}, | ||
"c8": { | ||
"checkCoverage": true, | ||
"branches": 100, | ||
"statements": 100, | ||
"lines": 100, | ||
"functions": 100 | ||
}, | ||
"browserslist": [ | ||
"cover 100%" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/brettz9/getJSDocComment.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/brettz9/getJSDocComment/issues" | ||
}, | ||
"homepage": "https://github.com/brettz9/getJSDocComment", | ||
"engines": { | ||
"node": ">=10.0.0" | ||
}, | ||
"dependencies": { | ||
"comment-parser": "^1.1.5", | ||
"esquery": "^1.4.0", | ||
"jsdoctypeparser": "^9.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.14.0", | ||
"@babel/plugin-syntax-class-properties": "^7.12.13", | ||
"@babel/preset-env": "^7.14.0", | ||
"@brettz9/eslint-plugin": "^1.0.3", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"c8": "^7.7.1", | ||
"chai": "^4.3.4", | ||
"eslint": "^7.25.0", | ||
"eslint-config-ash-nazg": "29.12.1", | ||
"eslint-config-standard": "^16.0.2", | ||
"eslint-plugin-array-func": "^3.1.7", | ||
"eslint-plugin-compat": "^3.9.0", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-html": "^6.1.2", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsdoc": "^32.3.1", | ||
"eslint-plugin-markdown": "^2.0.1", | ||
"eslint-plugin-no-unsanitized": "^3.1.5", | ||
"eslint-plugin-no-use-extend-native": "^0.5.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"eslint-plugin-radar": "^0.2.1", | ||
"eslint-plugin-unicorn": "^31.0.0", | ||
"mocha": "^8.3.2", | ||
"rollup": "^2.46.0" | ||
}, | ||
"scripts": { | ||
"rollup": "rollup -c", | ||
"eslint": "eslint --ext=jd,md,html", | ||
"lint": "npm run eslint", | ||
"mocha": "mocha --require chai/register-expect", | ||
"c8": "c8 npm run mocha", | ||
"test": "npm run lint && npm run rollup && npm run c8" | ||
} | ||
"name": "@es-joy/jsdoccomment", | ||
"version": "0.7.0", | ||
"author": "Brett Zamir <brettz9@yahoo.com>", | ||
"contributors": [], | ||
"description": "Maintained replacement for ESLint's deprecated SourceCode#getJSDocComment", | ||
"license": "MIT", | ||
"keywords": [ | ||
"eslint", | ||
"sourcecode" | ||
], | ||
"type": "module", | ||
"main": "./dist/index.cjs.cjs", | ||
"exports": { | ||
"require": "./dist/index.cjs.cjs", | ||
"import": "./src/index.js" | ||
}, | ||
"c8": { | ||
"checkCoverage": true, | ||
"branches": 100, | ||
"statements": 100, | ||
"lines": 100, | ||
"functions": 100 | ||
}, | ||
"browserslist": [ | ||
"cover 100%" | ||
], | ||
"scripts": { | ||
"prepublishOnly": "npm run rollup", | ||
"rollup": "rollup -c", | ||
"eslint": "eslint --ext=jd,md,html", | ||
"lint": "npm run eslint", | ||
"mocha": "mocha --require chai/register-expect", | ||
"c8": "c8 npm run mocha", | ||
"test": "npm run lint && npm run rollup && npm run c8" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/brettz9/getJSDocComment.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/brettz9/getJSDocComment/issues" | ||
}, | ||
"homepage": "https://github.com/brettz9/getJSDocComment", | ||
"engines": { | ||
"node": ">=10.0.0" | ||
}, | ||
"dependencies": { | ||
"comment-parser": "^1.1.5", | ||
"esquery": "^1.4.0", | ||
"jsdoctypeparser": "^9.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.14.0", | ||
"@babel/plugin-syntax-class-properties": "^7.12.13", | ||
"@babel/preset-env": "^7.14.0", | ||
"@brettz9/eslint-plugin": "^1.0.3", | ||
"@rollup/plugin-babel": "^5.3.0", | ||
"c8": "^7.7.1", | ||
"chai": "^4.3.4", | ||
"eslint": "^7.25.0", | ||
"eslint-config-ash-nazg": "29.12.1", | ||
"eslint-config-standard": "^16.0.2", | ||
"eslint-plugin-array-func": "^3.1.7", | ||
"eslint-plugin-compat": "^3.9.0", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-html": "^6.1.2", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsdoc": "^32.3.1", | ||
"eslint-plugin-markdown": "^2.0.1", | ||
"eslint-plugin-no-unsanitized": "^3.1.5", | ||
"eslint-plugin-no-use-extend-native": "^0.5.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-promise": "^5.1.0", | ||
"eslint-plugin-radar": "^0.2.1", | ||
"eslint-plugin-unicorn": "^31.0.0", | ||
"mocha": "^8.3.2", | ||
"rollup": "^2.46.0" | ||
} | ||
} |
@@ -11,2 +11,4 @@ # @es-joy/jsdoccomment | ||
- `parseComment` - For parsing `comment-parser` in a JSDoc-specific manner. | ||
Might wish to have tags with or without tags, etc. derived from a split off | ||
JSON file. | ||
- `commentHandler` - Used by `eslint-plugin-jsdoc`. Might be removed in future. | ||
@@ -23,2 +25,8 @@ - `commentParserToESTree`- Converts [comment-parser](https://github.com/syavorsky/comment-parser) | ||
- `toCamelCase` - A utility. Might be removed in future. | ||
- `hasSeeWithLink` - A utility to detect if a tag is `@see` and has a `@link` | ||
- `defaultNoTypes` = The tags which allow no types by default: | ||
`default`, `defaultvalue`, `see`; | ||
- `defaultNoNames` - The tags which allow no names by default: | ||
`access`, `author`, `default`, `defaultvalue`, `example`, `exception`, | ||
`license`, `return`, `returns`, `since`, `throws`, `version`, `variation` | ||
@@ -25,0 +33,0 @@ ## ESLint AST produced for `comment-parser` nodes (`JSDocBlock`, `JSDocTag`, and `JSDocDescriptionLine`) |
@@ -18,7 +18,22 @@ // Todo: We ideally would use comment-parser's es6 directory, but as the repo | ||
const hasSeeWithLink = (spec) => { | ||
export const hasSeeWithLink = (spec) => { | ||
return spec.tag === 'see' && (/\{@link.+?\}/u).test(spec.source[0].source); | ||
}; | ||
const getTokenizers = () => { | ||
export const defaultNoTypes = ['default', 'defaultvalue', 'see']; | ||
export const defaultNoNames = [ | ||
'access', 'author', | ||
'default', 'defaultvalue', | ||
'example', 'exception', | ||
'license', | ||
'return', 'returns', | ||
'since', 'throws', | ||
'version', 'variation' | ||
]; | ||
const getTokenizers = ({ | ||
noTypes = defaultNoTypes, | ||
noNames = defaultNoNames | ||
} = {}) => { | ||
// trim | ||
@@ -31,3 +46,3 @@ return [ | ||
(spec) => { | ||
if (['default', 'defaultvalue', 'see'].includes(spec.tag)) { | ||
if (noTypes.includes(spec.tag)) { | ||
return spec; | ||
@@ -64,7 +79,3 @@ } | ||
if ([ | ||
'example', 'return', 'returns', 'throws', 'exception', | ||
'access', 'version', 'since', 'license', 'author', | ||
'default', 'defaultvalue', 'variation' | ||
].includes(spec.tag) || hasSeeWithLink(spec)) { | ||
if (noNames.includes(spec.tag) || hasSeeWithLink(spec)) { | ||
return spec; | ||
@@ -71,0 +82,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
44226
1097
148