Skip to content

Commit

Permalink
Add SonarJS issues to CHANGELOG, based on 'eslint-plugin' label
Browse files Browse the repository at this point in the history
  • Loading branch information
vdiez committed Dec 5, 2024
1 parent 9eb5510 commit bfa844f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
14 changes: 11 additions & 3 deletions packages/jsts/src/rules/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
## 2024-12-05, Version 3.0.1

- [[ESLINTJS-64](https://sonarsource.atlassian.net/browse/ESLINTJS-64)] - Fix `Usage` section of the documentation
- [[ESLINTJS-61](https://sonarsource.atlassian.net/browse/ESLINTJS-61)] - Allow for wider margin of Typescript versions
- [[ESLINTJS-55](https://sonarsource.atlassian.net/browse/ESLINTJS-55)] - Create solution for release notes

## 2024-12-02, Version 3.0.0

- [[ESLINTJS-65](https://sonarsource.atlassian.net/browse/ESLINTJS-65)] - Remove decorated rules from ESLint plugin
- [[ESLINTJS-58](https://sonarsource.atlassian.net/browse/ESLINTJS-58)] - Change homepage to point to README.md in rules folder
- [[ESLINTJS-57](https://sonarsource.atlassian.net/browse/ESLINTJS-57)] - Remove "sonar-" from eslint-plugin-sonarjs rule names
- [[JS-359](https://sonarsource.atlassian.net/browse/JS-359)] - Create rule S6418 (`no-hardcoded-secrets`): Hard-coded secrets are security-sensitive

* [[ESLINTJS-65](https://sonarsource.atlassian.net/browse/ESLINTJS-65)] - Remove decorated rules from ESLint plugin
* [[ESLINTJS-58](https://sonarsource.atlassian.net/browse/ESLINTJS-58)] - Change homepage to point to README.md in rules folder
* [[ESLINTJS-57](https://sonarsource.atlassian.net/browse/ESLINTJS-57)] - Remove "sonar-" from eslint-plugin-sonarjs rule names

## 2024-10-18, Version 2.0.4

Expand Down
14 changes: 8 additions & 6 deletions tools/update-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@ import { fileURLToPath } from 'node:url';

const version = process.argv[2];

export const DIRNAME = dirname(fileURLToPath(import.meta.url));
const changelogPath = join(DIRNAME, '..', 'packages', 'jsts', 'src', 'rules', 'CHANGELOG.md');
const changelog = await readFile(changelogPath, 'utf8').catch(() => '');

const startDate = changelog.match(/^## (\d+-\d+-\d+)/)[1];

const response = await fetch(
encodeURI(
`https://sonarsource.atlassian.net/rest/api/2/search?jql=fixVersion=${version} and project="ESLINTJS"`,
`https://sonarsource.atlassian.net/rest/api/2/search?jql=(project = ESLINTJS AND fixversion = ${version}) OR (project = JS AND labels = eslint-plugin AND resolutiondate > '${startDate}') `,
),
);
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}

export const DIRNAME = dirname(fileURLToPath(import.meta.url));
const changelogPath = join(DIRNAME, '..', 'packages', 'jsts', 'src', 'rules', 'CHANGELOG.md');
const changelog = await readFile(changelogPath, 'utf8').catch(() => '');

const json = await response.json();
let newVersionStr = `## ${json.issues[0].fields.fixVersions[0].releaseDate}, Version ${version}\n\n`;
let newVersionStr = `## ${new Date().toISOString().split('T')[0]}, Version ${version}\n\n`;
json.issues.forEach(issue => {
newVersionStr += `* \[[${issue.key}](https://sonarsource.atlassian.net/browse/${issue.key})] - ${issue.fields.summary}\n`;
});
Expand Down

0 comments on commit bfa844f

Please sign in to comment.