Skip to content

Commit

Permalink
Merge branch 'master' into task/0-match-section-invalid-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
capricorn86 committed Jan 15, 2024
2 parents cf5abd7 + 5faca75 commit 85ea7d7
Show file tree
Hide file tree
Showing 303 changed files with 25,644 additions and 11,661 deletions.
186 changes: 186 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
const WARN = "warn";
const ERROR = "error";
const OFF = "off";

const COMMON_CONFIG = {
plugins: ["jsdoc", "filenames", "import", "prettier"],
extends: ["prettier", "plugin:prettier/recommended"],
rules: {
"prettier/prettier": WARN,
"no-underscore-dangle": OFF,
"no-debugger": WARN,
"space-infix-ops": ERROR,
"no-console": WARN,
"wrap-iife": OFF,
"no-self-assign": ERROR,
"no-self-compare": ERROR,
"no-loop-func": OFF,
"array-callback-return": ERROR,
curly: ERROR,
"no-fallthrough": OFF,
"dot-notation": OFF,
"prefer-const": WARN,
"no-empty-function": OFF,
"no-with": ERROR,
"one-var": [ERROR, "never"],
camelcase: [WARN, { properties: "always", ignoreImports: true }],
"spaced-comment": [WARN, "always"],
"capitalized-comments": [WARN, "always", { ignorePattern: "prettier" }],
"no-useless-rename": WARN,
"jsdoc/check-alignment": WARN,
"jsdoc/check-examples": OFF,
"jsdoc/check-indentation": WARN,
"jsdoc/check-syntax": WARN,
"jsdoc/check-tag-names": WARN,
"jsdoc/check-types": WARN,
"jsdoc/implements-on-classes": WARN,
"jsdoc/match-description": OFF,
"jsdoc/newline-after-description": WARN,
"jsdoc/no-types": OFF,
"jsdoc/no-undefined-types": OFF,
"jsdoc/require-description": OFF,
"jsdoc/require-description-complete-sentence": OFF,
"jsdoc/require-example": OFF,
"jsdoc/require-hyphen-before-param-description": [WARN, "never"],
"jsdoc/require-param": WARN,
"jsdoc/require-param-name": WARN,
"jsdoc/require-returns-check": WARN,
"jsdoc/require-returns-description": WARN,
"jsdoc/valid-types": WARN,
"filenames/match-exported": WARN,
"no-useless-constructor": WARN,
"jsdoc/require-jsdoc": [
WARN,
{
require: {
ArrowFunctionExpression: false,
FunctionDeclaration: false,
FunctionExpression: false,
ClassDeclaration: true,
MethodDefinition: true,
},
},
],
"import/no-extraneous-dependencies": WARN,
},
};

const TS_PARSER_FIELDS = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2020,
sourceType: "module",
},
};

module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
overrides: [
{
files: ["*.js", "*.jsx", "*.mjs"],
...TS_PARSER_FIELDS,
plugins: COMMON_CONFIG.plugins,
extends: COMMON_CONFIG.extends,
rules: {
...COMMON_CONFIG.rules,
"no-undef": ERROR,
"jsdoc/check-param-names": WARN,
"jsdoc/require-param-type": WARN,
"jsdoc/require-returns": WARN,
"jsdoc/require-param-description": WARN,
"jsdoc/require-returns-type": WARN,
"consistent-return": WARN,
},
},
{
files: ["*.json"],
plugins: ["json"],
extends: ["eslint:recommended", "plugin:json/recommended"],
},
{
files: ["*.ts", "*.tsx"],
plugins: [...COMMON_CONFIG.plugins, "@typescript-eslint"],
...TS_PARSER_FIELDS,
extends: [
...COMMON_CONFIG.extends,
"plugin:@typescript-eslint/recommended",
],
rules: {
...COMMON_CONFIG.rules,
"@typescript-eslint/explicit-member-accessibility": [
ERROR,
{ overrides: { constructors: "no-public" } },
],
"@typescript-eslint/no-unused-vars": OFF, // TSC is already doing this
"@typescript-eslint/ban-types": OFF, // TSC is already doing this
"no-undef": OFF, // TSC is already doing this
"@typescript-eslint/no-var-requires": OFF,
"@typescript-eslint/explicit-module-boundary-types": OFF, // TSC is already doing this
"@typescript-eslint/consistent-type-assertions": [
WARN,
{ assertionStyle: "angle-bracket" },
],
"@typescript-eslint/no-explicit-any": OFF,
"@typescript-eslint/no-empty-function": OFF,
"@typescript-eslint/no-use-before-define": OFF,
"@typescript-eslint/no-this-alias": OFF,
"@typescript-eslint/explicit-function-return-type": [
ERROR,
{ allowExpressions: true },
],
"@typescript-eslint/member-ordering": [
WARN,
{
default: [
"signature",
"field",
"constructor",
["get", "set"],
"method",
],
},
],
"@typescript-eslint/ban-ts-comment": OFF,
"jsdoc/no-types": WARN,
"import/named": OFF,
"import/no-named-as-default": WARN,
"import/no-extraneous-dependencies": WARN,
"import/no-absolute-path": WARN,
"@typescript-eslint/naming-convention": [
WARN,
{
selector: "interface",
format: ["PascalCase"],
prefix: ["I"],
},
{
selector: "enum",
format: ["PascalCase"],
suffix: ["Enum"],
},
{
selector: "typeParameter",
format: ["PascalCase"],
},
{
selector: "memberLike",
modifiers: ["private"],
leadingUnderscore: "allow",
format: ["camelCase"],
},
{
selector: "class",
format: ["PascalCase"],
},
],
},
},
],
};
2 changes: 1 addition & 1 deletion .huskyrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"hooks": {
"pre-commit": "npm run lint:fix",
"pre-commit": "npm run lint:changed",
"commit-msg": "node ./bin/husky-commit-message.js --filepath=$HUSKY_GIT_PARAMS%HUSKY_GIT_PARAMS%"
}
}
5 changes: 5 additions & 0 deletions .lintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/node_modules
**/tmp
**/lib
**/cjs
**/tmp
74 changes: 46 additions & 28 deletions bin/generate-release-notes.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,77 @@
#!/bin/env node
'use strict';
"use strict";

const GitUtility = require('../build/GitUtility');
const FS = require('fs');
const Path = require('path');
const GitUtility = require("../build/GitUtility");
const FS = require("fs");
const Path = require("path");

process.on('unhandledRejection', error => {
/* eslint-disable no-console*/

process.on("unhandledRejection", (error) => {
console.error(error);
process.exit(1);
});

async function main() {
const nextVersion = process.argv.find(text => text.startsWith('--next-version=')).split('=').reverse()[0];
const latestVersion = process.argv.find(text => text.startsWith('--latest-version=')).split('=').reverse()[0];
const nextVersion = process.argv
.find((text) => text.startsWith("--next-version="))
.split("=")
.reverse()[0];
const latestVersion = process.argv
.find((text) => text.startsWith("--latest-version="))
.split("=")
.reverse()[0];

const commitMessages = await GitUtility.getCommitMessages('v' + latestVersion, 'v' + nextVersion);
const commitMessages = await GitUtility.getCommitMessages(
"v" + latestVersion,
"v" + nextVersion
);
const commits = { trivial: [], patch: [], minor: [], major: [] };
const duplicates = { trivial: [], patch: [], minor: [], major: [] };

for (const commitMessage of commitMessages) {
const parsed = GitUtility.parseCommitMessage(commitMessage);

if (parsed.commit && !parsed.errors.length && !duplicates[parsed.commit.versionType].includes(parsed.commit.description)) {

if (
parsed.commit &&
!parsed.errors.length &&
!duplicates[parsed.commit.versionType].includes(parsed.commit.description)
) {
commits[parsed.commit.versionType].push(parsed.commit);
duplicates[parsed.commit.versionType].push(parsed.commit.description);
}
}
let output = [];
if(commits.major.length > 0) {
let notes = '### :bomb: Breaking Changes\n\n'
for(const commit of commits.major) {

const output = [];

if (commits.major.length > 0) {
let notes = "### :bomb: Breaking Changes\n\n";
for (const commit of commits.major) {
notes += ` - ${commit.description} (${commit.taskId})\n`;
}
output.push(notes);
}
if(commits.minor.length > 0) {
let notes = '### :art: Features\n\n'
for(const commit of commits.minor) {

if (commits.minor.length > 0) {
let notes = "### :art: Features\n\n";
for (const commit of commits.minor) {
notes += ` - ${commit.description} (${commit.taskId})\n`;
}
output.push(notes);
}
if(commits.patch.length > 0) {
let notes = '### :construction_worker_man: Patch fixes\n\n';
for(const commit of commits.patch) {

if (commits.patch.length > 0) {
let notes = "### :construction_worker_man: Patch fixes\n\n";
for (const commit of commits.patch) {
notes += ` - ${commit.description} (${commit.taskId})\n`;
}
output.push(notes);
}

await FS.promises.writeFile(Path.resolve('RELEASE_NOTES.md'), output.join('\n\n'));

await FS.promises.writeFile(
Path.resolve("RELEASE_NOTES.md"),
output.join("\n\n")
);
}

main();
main();
36 changes: 21 additions & 15 deletions bin/husky-commit-message.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
#!/bin/env node
'use strict';
"use strict";

const Fs = require('fs');
const Path = require('path');
const Chalk = require('chalk');
const GitUtility = require('../build/GitUtility');
const Fs = require("fs");
const Path = require("path");
const Chalk = require("chalk");
const GitUtility = require("../build/GitUtility");

process.on('unhandledRejection', error => {
/* eslint-disable no-console*/

process.on("unhandledRejection", (error) => {
console.error(error);
process.exit(1);
});

async function main() {
const argument = process.argv.find(text => text.startsWith('--filepath='));
const filepath = argument ? argument
.split(/=/)[1]
.replace('%HUSKY_GIT_PARAMS%', '')
.replace('$HUSKY_GIT_PARAMS', '') : null;
const argument = process.argv.find((text) => text.startsWith("--filepath="));
const filepath = argument
? argument
.split(/=/)[1]
.replace("%HUSKY_GIT_PARAMS%", "")
.replace("$HUSKY_GIT_PARAMS", "")
: null;

if (!filepath) {
throw new Error('Failed to validate commit message. The argument "--filepath=" was not provided.');
throw new Error(
'Failed to validate commit message. The argument "--filepath=" was not provided.'
);
}

const commitBuffer = await Fs.promises.readFile(Path.resolve(filepath));
const commitMessage = GitUtility.parseCommitMessage(commitBuffer.toString());

if (commitMessage.errors.length > 0) {
console.error(Chalk.red('\nCommit message validation failed:'));
console.error(Chalk.red("\nCommit message validation failed:"));

for (const error of commitMessage.errors) {
console.error(Chalk.red(` ✖ ${error}`));
}

console.log('');
console.log("");

process.exit(1);
}
}

main();
main();
10 changes: 6 additions & 4 deletions bin/print-latest-version.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/env node
'use strict';
"use strict";

const GitUtility = require('../build/GitUtility');
const GitUtility = require("../build/GitUtility");

process.on('unhandledRejection', error => {
/* eslint-disable no-console*/

process.on("unhandledRejection", (error) => {
console.error(error);
process.exit(1);
});
Expand All @@ -13,4 +15,4 @@ async function main() {
process.stdout.write(latestVersion);
}

main();
main();
Loading

0 comments on commit 85ea7d7

Please sign in to comment.