Skip to content

Commit 91409b8

Browse files
committed
Add linting, spellcheck, and editor configs
Add project tooling and editor configs: new cspell config and GitHub spellcheck workflow, .prettierignore, .nvmrc and VSCode recommendations/settings. Tighten linters and CI: expand .eslintrc rules, update super-linter/codeql YAML headers, enable an HTMLHint rule change. Update package.json: add htmlhint and cspell scripts, bump prettier, and record Volta node version. Apply small code hygiene changes to source and minified JS ("use strict" and clearer if/else), and normalize README badge text.
1 parent b354079 commit 91409b8

14 files changed

Lines changed: 118 additions & 12 deletions

.cspell.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "0.2",
3+
"words": [
4+
"christianoliff",
5+
"fediverse",
6+
"fnames",
7+
"Oliff",
8+
"stylelint",
9+
"tagname",
10+
"unspaced"
11+
],
12+
"allowCompoundWords": true,
13+
"language": "en,en-US",
14+
"ignorePaths": [
15+
".cspell.json",
16+
"**/node_modules/**"
17+
],
18+
"useGitignore": true
19+
}

.eslintrc.json

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,50 @@
11
{
22
"root": true,
33
"extends": ["eslint:recommended", "prettier"],
4+
"ignorePatterns": ["dark-mode-switch.min.js"],
45
"env": {
56
"browser": true,
67
"es6": true
78
},
89
"parserOptions": {
9-
"ecmaVersion": 2015,
10+
"ecmaVersion": 2020,
1011
"sourceType": "script"
1112
},
1213
"rules": {
14+
"strict": ["error", "global"],
15+
"curly": ["error", "all"],
16+
"eqeqeq": ["error", "always"],
17+
"no-alert": "error",
18+
"no-caller": "error",
19+
"no-console": "error",
20+
"no-else-return": "error",
21+
"no-eval": "error",
22+
"no-extend-native": "error",
23+
"no-extra-bind": "error",
24+
"no-implicit-coercion": "error",
25+
"no-implied-eval": "error",
26+
"no-iterator": "error",
27+
"no-labels": "error",
28+
"no-lone-blocks": "error",
29+
"no-multi-str": "error",
30+
"no-new-func": "error",
31+
"no-new-wrappers": "error",
32+
"no-octal-escape": "error",
33+
"no-proto": "error",
34+
"no-return-assign": "error",
35+
"no-script-url": "error",
36+
"no-self-compare": "error",
37+
"no-sequences": "error",
38+
"no-throw-literal": "error",
1339
"no-undef": "error",
40+
"no-unused-expressions": "error",
1441
"no-unused-vars": "error",
15-
"no-console": "warn",
16-
"eqeqeq": ["error", "always"],
17-
"curly": ["error", "all"],
42+
"no-useless-call": "error",
43+
"no-useless-concat": "error",
1844
"no-var": "off",
19-
"prefer-const": "off"
45+
"prefer-const": "off",
46+
"radix": "error",
47+
"wrap-iife": ["error", "outside"],
48+
"yoda": "error"
2049
}
2150
}

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: "CodeQL"
23

34
on:

.github/workflows/spellcheck.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: 'Check spelling'
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
concurrency:
10+
group: spellcheck-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
spellcheck:
18+
runs-on: ubuntu-latest
19+
if: ${{ github.actor != 'dependabot[bot]' }}
20+
steps:
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22+
with:
23+
persist-credentials: false
24+
25+
- uses: streetsidesoftware/cspell-action@9cd41bb518a24fefdafd9880cbab8f0ceba04d28 # v8.3.0
26+
with:
27+
check_dot_files: false
28+
incremental_files_only: true
29+
inline: warning
30+
suggestions: true

.github/workflows/super-linter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Lint Code Base
23

34
on:

.htmlhintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"id-unique": false,
2020
"inline-script-disabled": false,
2121
"inline-style-disabled": false,
22+
"link-rel-canonical-require": true,
2223
"main-require": true,
2324
"meta-charset-require": true,
2425
"meta-description-require": true,

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.22.2

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.min.*

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"EditorConfig.EditorConfig"
4+
]
5+
}

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"editor.codeActionsOnSave": {
3+
"source.fixAll.eslint": "explicit",
4+
"source.fixAll.stylelint": "always"
5+
},
6+
"editor.formatOnSave": true,
7+
"editor.renderWhitespace": "all",
8+
"eslint.validate": ["javascript"]
9+
}

0 commit comments

Comments
 (0)