![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
issue-parser
Advanced tools
Parser for Github, GitLab and Bitbucket issues actions, references and mentions
The issue-parser npm package is designed to parse issue references from commit messages, pull requests, and other text. It helps in extracting and managing issue references in a structured way.
Parsing Issue References
This feature allows you to parse issue references from a given text. In this example, the text 'Fixes #123' is parsed to extract the issue reference '#123'.
const issueParser = require('issue-parser')();
const result = issueParser('Fixes #123');
console.log(result);
Customizing Issue Patterns
This feature allows you to customize the patterns for issue references. In this example, the parser is configured to recognize 'gh-' as a valid issue prefix.
const issueParser = require('issue-parser')({
issuePrefixes: ['#', 'gh-'],
issueURLSegments: ['issues', 'pull']
});
const result = issueParser('Fixes gh-123');
console.log(result);
Parsing Multiple Issue References
This feature allows you to parse multiple issue references from a single text. In this example, the text 'Fixes #123, closes #456' is parsed to extract both issue references '#123' and '#456'.
const issueParser = require('issue-parser')();
const result = issueParser('Fixes #123, closes #456');
console.log(result);
The parse-commit-message package is used to parse and validate commit messages according to the Conventional Commits specification. It provides a structured way to handle commit messages, similar to how issue-parser handles issue references.
The commitlint package is used to lint commit messages based on predefined rules. It ensures that commit messages follow a specific format, which can include references to issues. While it doesn't parse issue references directly, it helps maintain a consistent format that can be parsed by tools like issue-parser.
Parser for Github, GitLab and Bitbucket issues actions, references and mentions
The parser can identify:
$ npm install --save issue-parser
const issueParser = require('issue-parser');
const parse = issueParser('github');
parse('Issue description, ref user/package#1, Fix #2, Duplicate of #3 /cc @user');
/*
{
refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}],
actions: {
close: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}],
duplicate: [{raw: 'Duplicate of #3', action: 'Duplicate of', prefix: '#', issue: '3'}],
},
mentions: [{raw: '@user', prefix: '@', user: 'user'}],
}
*/
const issueParser = require('issue-parser');
const parse = issueParser('gitlab');
parse('Issue description, ref group/user/package#1, !2, implement #3, /duplicate #4 /cc @user');
/*
{
refs: [
{raw: 'group/user/package#1', slug: 'group/user/package', prefix: '#', issue: '1'},
{raw: '!2', slug: 'group/user/package', prefix: '!', issue: '2'},
],
actions: {
close: [{raw: 'implement #3', action: 'Implement', prefix: '#', issue: '4'}],
duplicate: [{raw: 'Duplicate of #4', action: 'Duplicate of', prefix: '#', issue: '4'}],
},
mentions: [{raw: '@user', prefix: '@', user: 'user'}],
}
*/
const issueParser = require('issue-parser');
const parse = issueParser('bitbucket');
parse('Issue description, ref user/package#1, fixing #2. /cc @user');
/*
{
refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}],
actions: {
close: [{raw: 'fixing #2', action: 'Fixing', prefix: '#', issue: '2'}],
},
mentions: [{raw: '@user', prefix: '@', user: 'user'}],
}
*/
const issueParser = require('issue-parser');
const parse = issueParser({actions: {fix: ['complete'], hold: ['holds up']}, issuePrefixes: ['🐛']});
parse('Issue description, related to user/package🐛1, Complete 🐛2, holds up 🐛3');
/*
{
refs: [{raw: 'user/package🐛1', slug: 'user/package', prefix: '🐛', issue: '1'}],
actions: {
fix: [{raw: 'Complete 🐛2', action: 'Complete', prefix: '🐛', issue: '2'}],
hold: [{raw: 'holds up 🐛3', action: 'Holds up', prefix: '🐛', issue: '3'}],
},
}
*/
const issueParser = require('issue-parser');
const parse = issueParser('github', {actions: {parent: ['parent of'], related: ['related to']}});
parse('Issue description, ref user/package#1, Fix #2, Parent of #3, related to #4 /cc @user');
/*
{
refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}],
actions: {
close: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}],
parent: [{raw: 'Parent of #3', action: 'Parent of', prefix: '#', issue: '3'}],
related: [{raw: 'related to #4', action: 'Related to', prefix: '#', issue: '4'}],
},
mentions: [{raw: '@user', prefix: '@', user: 'user'}],
}
*/
#1
{refs: [{raw: '#1', slug: undefined, prefix: '#', issue: '1'}]}
owner/repo#1
{refs: [{raw: 'owner/repo#1', slug: 'owner/repo', prefix: '#', issue: '1'}]}
Fix #1
{actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}}
Duplicate of #1
{actions: {duplicate: [{raw: 'Duplicate of #1', action: 'Duplicate of', slug: undefined, prefix: '#', issue: '1'}]}}
@user
{mentions: [{raw: '@user', prefix: '@', user: 'user'}]}
https://github.com/owner/repo/pull/1
Fix https://github.com/owner/repo/issues/2
{
refs: [{raw: 'https://github.com/owner/repo/pull/1', slug: 'owner/repo', prefix: undefined, issue: '1'},]
actions: {
close: [
{raw: 'Fix https://github.com/owner/repo/issues/2', action: 'Fix', slug: 'owner/repo', prefix: undefined, issue: '2'}
]
}
}
FIX #1
{actions: {close: [{raw: 'FIX #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}}
Fix: #1
{actions: {close: [{raw: 'Fix: #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}}
Fix #1 `Fix #2` @user1 `@user2`
{
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},
mentions: [{raw: '@user1', prefix: '@', user: 'user1'}]
}
\`Fix #1\` \`@user\`
{
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},
mentions: [{raw: '@user1', prefix: '@', user: 'user1'}]
}
Fix #1
```js
console.log('Fix #2');
```
@user1
```js
console.log('@user2');
```
{
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},
mentions: [{raw: '@user1', prefix: '@', user: 'user1'}]
}
\`\`\`
Fix #1
\`\`\`
\`\`\`
@user
\`\`\`
{
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},
mentions: [{raw: '@user', prefix: '@', user: 'user'}]
}
Fix #1
<code>Fix #2</code>
<code><code>Fix #3</code></code>
@user1
<code>@user2</code>
{
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},
mentions: [{raw: '@user1', prefix: '@', user: 'user1'}]
}
`<code>`Fix #1`</code>`
`<code>`@user`</code>`
{
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},
mentions: [{raw: '@user', prefix: '@', user: 'user'}]
}
Fix #1 Fix #2a Fix a#3
{actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}}
Create a parser.
Type: Object
String
Parser options. Can be github
, gitlab
or bitbucket
for predefined options, or an object for custom options.
Type: Object
Default:
{close: ['close', 'closes', 'closed', 'closing', 'fix', 'fixes', 'fixed', 'fixing', 'resolve', 'resolves', 'resolved', 'resolving', 'implement', 'implements', 'implemented', 'implementing'], duplicate: ['Duplicate of', '/duplicate']}
Object with type of action as key and array of keywords as value.
Each keyword match will be placed in the corresponding property of the result
action
object. For example the with the configuration {actions: fix: ['fixed', 'fixing']}
each action matching fixed
or fixing
will be under result.actions.fix
.
Type: Array<String>
String
Default: [':']
List of delimiter characters allowed between an action keywords and the issue reference. The characters space (
) and tab (
) are always allowed.
Type: Array<String>
String
Default: ['@']
List of keywords used to identify user mentions.
Type: Array<String>
String
Default: ['#', 'gh-']
List of keywords used to identify issues and pull requests.
Type: Array<String>
String
Default: ['https://github.com', 'https://gitlab.com']
List of base URL used to identify issues and pull requests with full URL.
Type: Array<String>
String
Default: ['issues', 'pull', 'merge_requests']
List of URL segment used to identify issues and pull requests with full URL.
Type: Object
Option overrides. Useful when using predefined options
(such as github
, gitlab
or bitbucket
). The overrides
object can define the same properties as options
.
For example, the following will use all the github
predefined options but with a different hosts
option:
const issueParser = require('issue-parser');
const parse = issueParser('github', {hosts: ['https://custom-url.com']});
Parse an issue description and returns a Result object.
Type: String
Issue text to parse.
Type: Object
List of matching actions by type.
Each type of action is an array of objects with the following properties:
Name | Type | Description |
---|---|---|
raw | String | The raw value parsed, for example Fix #1 . |
action | String | The keyword used to identify the action, capitalized. |
slug | String | The repository owner and name, for issue referred as <owner>/<repo>#<issue number> . |
prefix | String | The prefix used to identify the issue. |
issue | String | The issue number. |
Type: Array<Object>
List of issues and pull requests referenced, but not matched with an action.
Each reference has the following properties:
Name | Type | Description |
---|---|---|
raw | String | The raw value parsed, for example #1 . |
slug | String | The repository owner and name, for issue referred as <owner>/<repo>#<issue number> . |
prefix | String | The prefix used to identify the issue. |
issue | String | The issue number. |
Type: Array<Object>
List of users mentioned.
Each mention has the following properties:
Name | Type | Description |
---|---|---|
raw | String | The raw value parsed, for example @user . |
prefix | String | The prefix used to identify the mention. |
user | String | The user name |
Type: Array<Object>
List of all issues and pull requests referenced or matching an action.
Each reference has the following properties:
Name | Type | Description |
---|---|---|
raw | String | The raw value parsed, for example Fix #1 . |
action | String | The keyword used to identify the action or the duplicate, capitalized. Only if matched by an action. |
slug | String | The repository owner and name, for issue referred as <owner>/<repo>#<issue number> . |
prefix | String | The prefix used to identify the issue. |
issue | String | The issue number. |
FAQs
Parser for Github, GitLab and Bitbucket issues actions, references and mentions
The npm package issue-parser receives a total of 1,156,213 weekly downloads. As such, issue-parser popularity was classified as popular.
We found that issue-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.