Skip to content

Commit f763130

Browse files
committed
Add linter and dependabot configs
1 parent 1290304 commit f763130

File tree

10 files changed

+176
-0
lines changed

10 files changed

+176
-0
lines changed

.github/dependabot.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'npm'
4+
directory: '/'
5+
schedule:
6+
interval: 'weekly'
7+
groups:
8+
docusaurus:
9+
patterns:
10+
- '*docusaurus*'
11+
linters:
12+
patterns:
13+
- '*lint*'
14+
- 'globals'
15+
- 'husky'
16+
- 'prettier'
17+
react:
18+
patterns:
19+
- 'react'
20+
- 'react-dom'
21+
- '@types/react'
22+
- '@types/react-dom'
23+
ignore:
24+
# Pin key docusaurus dependencies to major versions
25+
- dependency-name: 'react'
26+
update-types: ['version-update:semver-major']
27+
- dependency-name: '@mdx-js/react'
28+
update-types: ['version-update:semver-major']
29+
- dependency-name: 'prism-react-renderer'
30+
update-types: ['version-update:semver-major']
31+
- package-ecosystem: 'github-actions'
32+
directory: '/'
33+
schedule:
34+
interval: 'weekly'

.husky/pre-commit

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

.lintstagedrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"*.{js,jsx,ts,tsx,mjs,cjs,mdx}": ["npx prettier --write", "npx eslint --fix"],
3+
"*.md": ["npx prettier --write", "npx markdownlint-cli2 --fix"],
4+
"*.{css,json,jsonc,yaml,yml}": ["npx prettier --write"]
5+
}

.markdownlint-cli2.jsonc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"gitignore": true,
3+
"globs": ["**/*.md"],
4+
"ignores": ["docs/toolhive/reference/cli/"],
5+
}

.markdownlint.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"code-block-style": {
3+
"style": "fenced"
4+
},
5+
"code-fence-style": {
6+
"style": "backtick"
7+
},
8+
"emphasis-style": {
9+
"style": "underscore"
10+
},
11+
"heading-style": {
12+
"style": "atx"
13+
},
14+
"hr-style": {
15+
"style": "---"
16+
},
17+
"line-length": {
18+
"code_blocks": false,
19+
"line_length": 80,
20+
"tables": false
21+
},
22+
"no-bare-urls": false,
23+
"proper-names": {
24+
"code_blocks": false,
25+
"names": ["Copilot", "GitHub", "ToolHive"]
26+
},
27+
"strong-style": {
28+
"style": "asterisk"
29+
},
30+
"table-pipe-style": {
31+
"style": "leading_and_trailing"
32+
},
33+
"ul-style": {
34+
"style": "dash"
35+
}
36+
}

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore autogenerated files
2+
docs/toolhive/reference/cli/**/*.md

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"jsxSingleQuote": true,
3+
"printWidth": 80,
4+
"proseWrap": "always",
5+
"singleQuote": true,
6+
"tabWidth": 2,
7+
"trailingComma": "es5",
8+
"useTabs": false
9+
}

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"unifiedjs.vscode-mdx",
4+
"esbenp.prettier-vscode",
5+
"davidanson.vscode-markdownlint"
6+
]
7+
}

.vscode/settings.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"mdx.validate.validateFileLinks": "warning",
4+
"mdx.validate.validateFragmentLinks": "warning",
5+
"mdx.validate.validateMarkdownFileLinkFragments": "warning",
6+
"mdx.validate.validateReferences": "warning",
7+
"mdx.validate.validateUnusedLinkDefinitions": "hint",
8+
"prettier.configPath": ".prettierrc",
9+
"prettier.requireConfig": true,
10+
"yaml.format.proseWrap": "always",
11+
"css.lint.emptyRules": "ignore",
12+
13+
"[markdown]": {
14+
"editor.defaultFormatter": "esbenp.prettier-vscode"
15+
},
16+
"[mdx]": {
17+
"editor.defaultFormatter": "esbenp.prettier-vscode"
18+
},
19+
"[css]": {
20+
"editor.defaultFormatter": "esbenp.prettier-vscode"
21+
},
22+
"[json]": {
23+
"editor.defaultFormatter": "esbenp.prettier-vscode"
24+
},
25+
"[yaml]": {
26+
"editor.defaultFormatter": "esbenp.prettier-vscode"
27+
}
28+
}

eslint.config.mjs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import globals from 'globals';
2+
import pluginJs from '@eslint/js';
3+
import tseslint from 'typescript-eslint';
4+
import pluginReact from 'eslint-plugin-react';
5+
import eslintConfigPrettier from 'eslint-config-prettier';
6+
import * as mdx from 'eslint-plugin-mdx';
7+
8+
/** @type {import('eslint').Linter.Config[]} */
9+
export default [
10+
{ ignores: ['.docusaurus/', 'build/', 'node_modules/'] },
11+
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
12+
{ languageOptions: { globals: globals.node } },
13+
14+
pluginJs.configs.recommended,
15+
...tseslint.configs.recommended,
16+
pluginReact.configs.flat.recommended,
17+
eslintConfigPrettier,
18+
19+
// Configs for .mdx files
20+
{
21+
...mdx.flat,
22+
processor: mdx.createRemarkProcessor({
23+
lintCodeBlocks: false,
24+
languageMapper: {},
25+
}),
26+
rules: {
27+
...mdx.flat.rules,
28+
'react/no-unescaped-entities': 'off',
29+
'react/jsx-no-undef': ['error', { allowGlobals: true }],
30+
},
31+
languageOptions: {
32+
...mdx.flat.languageOptions,
33+
globals: {
34+
...mdx.flat.languageOptions.globals,
35+
// Add global components from src/theme/MDXComponents.tsx here
36+
//Columns: 'readonly',
37+
//Column: 'readonly',
38+
},
39+
},
40+
},
41+
42+
{
43+
settings: {
44+
react: {
45+
version: 'detect',
46+
},
47+
},
48+
},
49+
];

0 commit comments

Comments
 (0)