Chore: Add issue/pr template and general housekeeping tools and docs (#900)

* Add linting

* Add issue templates and docs

* Add root eslint config and remove tslint

* Autofix lint issues
This commit is contained in:
Justin Halsall
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 4cfd9db6cf
commit 99e158bd39
44 changed files with 2505 additions and 2249 deletions

View File

@@ -11,7 +11,8 @@
"bundle:es-only": "cross-env ES_ONLY=true rollup --config",
"dev": "yarn bundle:es-only --watch",
"typings": "tsc -d --declarationDir typings",
"prepublish": "npm run typings && npm run bundle"
"prepublish": "npm run typings && npm run bundle",
"lint": "yarn eslint src"
},
"repository": {
"type": "git",
@@ -55,7 +56,6 @@
"ts-jest": "^27.0.5",
"ts-node": "^7.0.1",
"tslib": "^1.9.3",
"tslint": "^4.5.1",
"typescript": "^3.9.7"
}
}

View File

@@ -242,7 +242,7 @@ export function parse(css: string, options: ParserOptions = {}) {
if (lines) {
lineno += lines.length;
}
let i = str.lastIndexOf('\n');
const i = str.lastIndexOf('\n');
column = i === -1 ? column + str.length : str.length - i;
}
@@ -457,7 +457,7 @@ export function parse(css: string, options: ParserOptions = {}) {
const pos = position();
// prop
let propMatch = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
const propMatch = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
if (!propMatch) {
return;
}

View File

@@ -148,7 +148,8 @@ function buildNode(
}
let value = n.attributes[name];
if (tagName === 'option' && name === 'selected' && value === false) {
// legacy fix (TODO: if `value === false` can be generated for other attrs, should we also omit those other attrs from build?)
// legacy fix (TODO: if `value === false` can be generated for other attrs,
// should we also omit those other attrs from build ?)
continue;
}
value =

View File

@@ -154,7 +154,7 @@ function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
function collectCharacters(regEx: RegExp) {
let chars: string;
let match = regEx.exec(attributeValue.substring(pos));
const match = regEx.exec(attributeValue.substring(pos));
if (match) {
chars = match[0];
pos += chars.length;
@@ -163,7 +163,7 @@ function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
return '';
}
let output = [];
const output = [];
while (true) {
collectCharacters(SRCSET_COMMAS_OR_SPACES);
if (pos >= attributeValue.length) {
@@ -182,7 +182,7 @@ function getAbsoluteSrcsetString(doc: Document, attributeValue: string) {
url = absoluteToDoc(doc, url);
let inParens = false;
while (true) {
let c = attributeValue.charAt(pos);
const c = attributeValue.charAt(pos);
if (c === '') {
output.push((url + descriptorsStr).trim());
break;
@@ -462,7 +462,7 @@ function serializeNode(
});
let cssText: string | null = null;
if (stylesheet) {
cssText = getCssRulesString(stylesheet as CSSStyleSheet);
cssText = getCssRulesString(stylesheet );
}
if (cssText) {
delete attributes.rel;

View File

@@ -1,21 +0,0 @@
{
"defaultSeverity": "error",
"extends": ["tslint:recommended"],
"jsRules": {},
"rules": {
"no-any": true,
"quotemark": [true, "single"],
"ordered-imports": false,
"object-literal-sort-keys": false,
"no-unused-variable": true,
"object-literal-key-quotes": false,
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-leading-underscore"
],
"arrow-parens": false
},
"rulesDirectory": []
}