Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
chharvey committed Apr 10, 2024
2 parents 55a7a23 + 16710fe commit 202669c
Show file tree
Hide file tree
Showing 70 changed files with 5,550 additions and 7,077 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig: https://EditorConfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = tab
indent_style = tab
insert_final_newline = true
max_line_length = off
trim_trailing_whitespace = true

[**/package{,-lock}.json]
indent_size = 2
indent_style = space
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist/
/docs/api/
225 changes: 225 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
{
"env": {
"es2021": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {"sourceType": "module"},
"plugins": ["@typescript-eslint"],
"reportUnusedDisableDirectives": true,
"root": true,
"extends": [
"eslint:recommended", // https://github.com/eslint/eslint/blob/main/conf/eslint-recommended.js
"plugin:@typescript-eslint/eslint-recommended", // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
"plugin:@typescript-eslint/recommended" // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.ts
],
"rules": {
/* # Overrides of Recommended Rules */
"no-irregular-whitespace": ["error", {
"skipStrings": false, // disallow in strings
"skipComments": true // allow in comments
}],
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"], // allow smart-tabs
"@typescript-eslint/no-unused-vars": "off", // ts(6196) & tsconfig(noUnusedLocals, noUnusedParameters)

/* # File Conventions (should be consistent with `/.editorconfig` file) */
"eol-last": "error",
"linebreak-style": "error",
"no-trailing-spaces": "error",

/* # Layout & Formatting */
/* ## Indentation, Spacing, and Alignment */
"arrow-spacing": "error",
"comma-spacing": "error", // NOTE: "@typescript-eslint/comma-spacing" is defective
"dot-location": ["error", "property"],
"func-call-spacing": "off",
"@typescript-eslint/func-call-spacing": "warn",
"generator-star-spacing": ["error", "both"],
"indent": ["error", "tab", { // NOTE: "@typescript-eslint/indent" is defective
"SwitchCase": 1,
"flatTernaryExpressions": true
}],
"key-spacing": ["error", {
"align": "value",
"mode": "minimum"
}],
"keyword-spacing": "off",
"@typescript-eslint/keyword-spacing": "error",
"rest-spread-spacing": "error",
"semi-spacing": "error",
"space-before-blocks": "off",
"@typescript-eslint/space-before-blocks": "error",
"space-before-function-paren": "off",
"@typescript-eslint/space-before-function-paren": ["warn", {
"anonymous": "always",
"asyncArrow": "always",
"named": "never"
}],
"space-infix-ops": "off",
"@typescript-eslint/space-infix-ops": "error",
"space-unary-ops": "error",
"switch-colon-spacing": "error",
"template-curly-spacing": ["error", "always"],
"template-tag-spacing": "error",
"yield-star-spacing": ["error", "both"],

/* ## Grouping Structure Style */
"array-bracket-newline": ["error", "consistent"], // FIXME: require line breaks exactly when there exist line breaks between elements (ignoring inside elements)
"array-bracket-spacing": "warn",
"array-element-newline": ["error", "consistent"],
"arrow-body-style": "error",
"brace-style": "off",
"@typescript-eslint/brace-style": "error",
"computed-property-spacing": "error",
"curly": "error",
"function-call-argument-newline": ["error", "consistent"],
"function-paren-newline": "error",
"func-style": ["error", "declaration", {"allowArrowFunctions": true}],
"lines-between-class-members": "off",
"@typescript-eslint/lines-between-class-members": ["error", "always", {"exceptAfterSingleLine": true}],
"no-useless-computed-key": ["error", {"enforceForClassMembers": true}],
"object-curly-newline": ["error", {
"ObjectExpression": {"multiline": true},
"ObjectPattern": {"multiline": true},
"ImportDeclaration": {"multiline": true, "minProperties": 2},
"ExportDeclaration": {"multiline": true, "minProperties": 2}
}],
"object-curly-spacing": "off",
"@typescript-eslint/object-curly-spacing": "warn",
"object-property-newline": ["error", {"allowAllPropertiesOnSameLine": true}],
"object-shorthand": ["error", "properties", {"avoidQuotes": true}],
"padded-blocks": ["error", "never"],
"quote-props": ["error", "consistent-as-needed"],
"space-in-parens": "warn",

/* ## Operator Style */
"arrow-parens": "error",
"comma-dangle": "off",
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
"comma-style": "error",
"dot-notation": "error",
"implicit-arrow-linebreak": "error",
"new-parens": "error",
"operator-linebreak": ["error", "before", {
"overrides": {
"=": "none",
"*=": "none",
"/=": "none",
"%=": "none",
"+=": "none",
"-=": "none",
"<<=": "none",
">>=": "none",
">>>=": "none",
"&=": "none",
"^=": "none",
"|=": "none",
"**=": "none",
"&&=": "none",
"||=": "none",
"??=": "none",
":": "ignore"
}
}],
"quotes": ["error", "single"],
"semi": "off",
"@typescript-eslint/semi": "error",
"semi-style": "error",
"wrap-iife": ["error", "inside", {"functionPrototypeMethods": true}],

/* # Best Practices */
/* ## Preferred Operators */
"eqeqeq": "error",
"no-useless-concat": "error",
"operator-assignment": "error",
"prefer-object-spread": "error",
"prefer-template": "error",

/* ## Variable Declarations */
"init-declarations": "off",
"@typescript-eslint/init-declarations": "error",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error", {"ignoreTypeReferences": false}],
"one-var": ["error", "never"],

/* ## Function Design */
"default-param-last": "off",
"@typescript-eslint/default-param-last": "error",
"func-names": ["error", "never"],
"no-return-await": "error",
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": "error",
"prefer-arrow-callback": ["error", {"allowUnboundThis": false}]
},
"overrides": [
{
"files": ["*.{cts,mts,ts}"],
"parserOptions": {
"project": [
"./tsconfig.json",
"./test/tsconfig.json",
"./tree-sitter-counterpoint/tsconfig.json",
"./tree-sitter-counterpoint/test/tsconfig.json"
]
},
"rules": {
/* # Overrides of Recommended Rules */
"@typescript-eslint/no-explicit-any": ["error", {"fixToUnknown": true}], // report as errors & quickfix `any` to `unknown`
"@typescript-eslint/no-inferrable-types": "off", // don’t rely on TypeScript inference
"@typescript-eslint/no-non-null-assertion": "off", // non-null assertions can be useful

/* # Layout & Formatting */
/* ## Indentation, Spacing, and Alignment */
"@typescript-eslint/type-annotation-spacing": "error",

/* ## Grouping Structure Style */
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/member-delimiter-style": ["error", {
"overrides": {
"typeLiteral": {
"multiline": {"delimiter": "comma"},
"singleline": {"delimiter": "comma"}
}
}
}],

/* ## Operator Style */
"dot-notation": "off",
"@typescript-eslint/dot-notation": "error", // needed here due to `parserOptions.project`

/* ## Type Annotations */
"@typescript-eslint/array-type": ["error", {
"default": "array-simple",
"readonly": "array"
}],
"@typescript-eslint/consistent-generic-constructors": "error",
"@typescript-eslint/consistent-indexed-object-style": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {
"allowExpressions": true,
"allowHigherOrderFunctions": false
}],
"@typescript-eslint/no-import-type-side-effects": "error",

/* # Best Practices */
/* ## Conciseness */
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/no-unnecessary-type-arguments": "error",

/* ## Function Design */
"no-return-await": "off",
"@typescript-eslint/return-await": "error", // needed here due to `parserOptions.project` // NOTE: overrides "no-return-await" (despite different name)

/* ## Strictness */
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/non-nullable-type-assertion-style": "error",
"@typescript-eslint/prefer-readonly": "error"
}
}
]
}
18 changes: 16 additions & 2 deletions docs/api/assets/highlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
--dark-hl-6: #6A9955;
--light-hl-7: #267F99;
--dark-hl-7: #4EC9B0;
--light-hl-8: #0070C1;
--dark-hl-8: #4FC1FF;
--light-hl-8: #AF00DB;
--dark-hl-8: #C586C0;
--light-hl-9: #000000FF;
--dark-hl-9: #D4D4D4;
--light-hl-10: #000000;
--dark-hl-10: #C8C8C8;
--light-hl-11: #0070C1;
--dark-hl-11: #4FC1FF;
--light-code-background: #FFFFFF;
--dark-code-background: #1E1E1E;
}
Expand All @@ -34,6 +38,8 @@
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--hl-11: var(--light-hl-11);
--code-background: var(--light-code-background);
} }

Expand All @@ -48,6 +54,8 @@
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--hl-11: var(--dark-hl-11);
--code-background: var(--dark-code-background);
} }

Expand All @@ -62,6 +70,8 @@
--hl-7: var(--light-hl-7);
--hl-8: var(--light-hl-8);
--hl-9: var(--light-hl-9);
--hl-10: var(--light-hl-10);
--hl-11: var(--light-hl-11);
--code-background: var(--light-code-background);
}

Expand All @@ -76,6 +86,8 @@
--hl-7: var(--dark-hl-7);
--hl-8: var(--dark-hl-8);
--hl-9: var(--dark-hl-9);
--hl-10: var(--dark-hl-10);
--hl-11: var(--dark-hl-11);
--code-background: var(--dark-code-background);
}

Expand All @@ -89,4 +101,6 @@
.hl-7 { color: var(--hl-7); }
.hl-8 { color: var(--hl-8); }
.hl-9 { color: var(--hl-9); }
.hl-10 { color: var(--hl-10); }
.hl-11 { color: var(--hl-11); }
pre, code { background: var(--code-background); }
Loading

0 comments on commit 202669c

Please sign in to comment.