Skip to content

Commit cba8df8

Browse files
authored
Merge pull request #1411 from grafana/new-docs/prettier-eslint
2 parents 672a21f + 29d2787 commit cba8df8

File tree

5 files changed

+72
-5
lines changed

5 files changed

+72
-5
lines changed

.eslintignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
.cache/
22
public/
33
node_modules/
4-
docs/sources/
54
docs/sources/get-started/run-cloud-tests-from-the-CLI.md
65
docs/sources/get-started/run-your-first-tests.md
76
CONTRIBUTING_FILE_FORMAT.md
87
src/data/markdown/docs/40 xk6-disruptor/01 Get started/01 First steps.md
9-
src/data/markdown/docs/40 xk6-disruptor/01 Get started/04 Expose Your Application.md
8+
src/data/markdown/docs/40 xk6-disruptor/01 Get started/04 Expose Your Application.md
109
src/data/markdown/docs/40 xk6-disruptor/04 Examples/01 Inject Grpc faults into Service.md
1110
src/data/markdown/docs/40 xk6-disruptor/04 Examples/02 Inject HTTP faults into Pod.md
1211
src/data/markdown/docs/05 Examples/02 Tutorials/01 Get started with k6/100 Test-for-functional-behavior.md

.lintstagedrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
2+
"docs/sources/**/*.md": [
3+
"prettier --parser markdown --write",
4+
"eslint -c ./docs/sources/.eslintrc.js --fix"
5+
],
26
"*.{js,jsx,css,scss}": "prettier --write",
37
"*.{js,jsx}": "eslint --fix",
4-
"*.{md,mdx}": "eslint -c ./src/data/markdown/.eslintrc.js --fix"
8+
"src/data/markdown/**/*.{md,mdx}": "eslint -c ./src/data/markdown/.eslintrc.js --fix"
59
}

docs/sources/.eslintrc.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
es2017: true,
5+
commonjs: true,
6+
},
7+
parserOptions: {
8+
ecmaVersion: '2017',
9+
sourceType: 'module',
10+
},
11+
extends: ['plugin:mdx/recommended', 'plugin:prettier/recommended'],
12+
plugins: ['markdown'],
13+
overrides: [
14+
{
15+
// Enable the Markdown processor for all .md files.
16+
files: ['**/*.md'],
17+
processor: 'markdown/markdown',
18+
},
19+
{
20+
// Customize the configuration ESLint uses for ```js, ```javascript
21+
files: ['**/*.md/*.js', '**/*.md/*.javascript'],
22+
rules: {
23+
'no-undef': 'error',
24+
'no-else-return': 'error',
25+
'no-extra-boolean-cast': 'error',
26+
'no-duplicate-case': 'error',
27+
'no-const-assign': 'error',
28+
'no-dupe-args': 'error',
29+
'no-dupe-else-if': 'error',
30+
'no-var': 'error',
31+
'use-isnan': 'error',
32+
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
33+
'prefer-const': 'error',
34+
},
35+
},
36+
],
37+
globals: {
38+
console: 'readonly',
39+
__VU: 'readonly',
40+
__ENV: 'readonly',
41+
__ITER: 'readonly',
42+
open: 'readonly',
43+
},
44+
};

docs/sources/.prettierrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"singleQuote": true,
3+
"quoteProps": "consistent",
4+
"trailingComma": "es5",
5+
"printWidth": 100,
6+
"overrides": [
7+
{
8+
"files": ["**/*.md"],
9+
"options": {
10+
"parser": "babel"
11+
}
12+
}
13+
]
14+
}

src/data/markdown/docs/40 xk6-disruptor/01 Get started/04 Expose Your Application.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ Until this issue is solved in `kubectl`, tests using port forwarding to access a
2929

3030
The simplest way to accomplish this is to ensure the scenario that executes the load (#2) starts after the scenario that injects the faults (#1):
3131

32+
<CodeGroup labels={["port forwarding options"]}>
33+
3234
```javascript
35+
export const options = {
3336
scenarios: {
3437
disrupt: { // #1 inject faults
3538
executor: 'shared-iterations',
@@ -47,8 +50,11 @@ The simplest way to accomplish this is to ensure the scenario that executes the
4750
startTime: '20s', // give time for the agents to be installed
4851
duration: "30s",
4952
}
50-
}
51-
```
53+
}
54+
}
55+
```
56+
57+
</CodeGroup>
5258

5359
## As a LoadBalancer service
5460

0 commit comments

Comments
 (0)