Skip to content

Commit f74cb4b

Browse files
committed
MNT Fix linting issues
DOC Document linting documentation DOC Document how to include filenames for code blocks
1 parent b45973f commit f74cb4b

File tree

333 files changed

+33653
-32654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

333 files changed

+33653
-32654
lines changed

.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,5 @@ indent_style = space
1010
insert_final_newline = true
1111
trim_trailing_whitespace = true
1212

13-
[*.md]
14-
trim_trailing_whitespace = false
15-
1613
[composer.json]
17-
indent_size = 4
14+
indent_size = 4

.eslintrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,24 @@ rules.overrides = [
1313
impliedStrict: true
1414
}
1515
},
16+
settings: {
17+
react: {
18+
version: '16'
19+
}
20+
},
1621
rules: {
22+
// These rules are not appropriate for linting markdown code blocks
1723
'lines-around-comment': 'off',
1824
'import/no-unresolved': 'off',
25+
'import/extensions': 'off',
26+
'react/jsx-no-undef': 'off',
1927
'no-undef': 'off',
2028
'no-unused-expressions': 'off',
2129
'no-unused-vars': 'off',
30+
'brace-style': 'off', // it's useful to have comments before the else block
31+
// These rules are disabled because they are difficult to adhere to right now
32+
'jsx-a11y/label-has-associated-control': 'off',
33+
'react/prefer-stateless-function': 'off',
2234
}
2335
}
2436
];

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
with:
3232
node-version: ${{ steps.read-nvm.outputs.version }}
3333

34-
- name: Install yarn and dependencies
34+
- name: Install yarn dependencies
3535
run: |
3636
npm install --global yarn
3737
yarn install
@@ -44,7 +44,7 @@ jobs:
4444

4545
- name: Install composer dependencies
4646
if: ${{ matrix.script == 'lint-php' }}
47-
run: composer install --prefer-dist --no-progress --ansi --no-interaction --no-scripts --no-plugins --optimize-autoloader
47+
run: composer install --prefer-dist --no-progress --ansi --no-interaction --optimize-autoloader
4848

4949
- name: Run lint
5050
run: yarn ${{ matrix.script }}

.markdownlint-cli2.mjs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11

2-
// const extraRules = require("extraRules");
32
import markdownlint from 'markdownlint';
3+
import enhancedProperNames from 'markdownlint-rule-enhanced-proper-names/src/enhanced-proper-names.js';
44
import titleCaseStyle from 'markdownlint-rule-title-case-style';
55
import { load } from 'js-yaml';
66

77
export default {
8-
'customRules': [ titleCaseStyle ],
8+
'customRules': [
9+
enhancedProperNames,
10+
titleCaseStyle,
11+
],
912
'config': markdownlint.readConfigSync('./.markdownlint.yml', [ load ]),
1013
};

.markdownlint.yml

Lines changed: 71 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,6 @@
11
# Enable all rules with default settings as a baseline
22
default: true
33

4-
customRules:
5-
- 'markdownlint-rule-title-case-style'
6-
7-
# markdownlint-rule-title-case-style: Use sentence-style headings
8-
title-case-style:
9-
case: 'sentence'
10-
ignore:
11-
- 'GitHub'
12-
- 'GraphQL'
13-
- 'JavaScript'
14-
- 'I'
15-
- 'InnoDB'
16-
- 'MyISAM'
17-
- 'MySQL'
18-
- 'RFCs'
19-
- 'Silverstripe'
20-
214
# MD041: Ignore the frontmatter (metadata) title when checking for H1s
225
first-line-h1:
236
front_matter_title: ''
@@ -46,7 +29,7 @@ ul-style:
4629
ol-prefix:
4730
style: 'one'
4831

49-
# MD013: Disable line-length rule (for now)
32+
# MD013: Disable line-length rule for now as it touches too many lines of doc
5033
line-length: false
5134
# line_length: 120
5235

@@ -69,7 +52,7 @@ code-block-style:
6952

7053
# MD048: Use backticks for codeblocks
7154
code-fence-style:
72-
style: backtick
55+
style: 'backtick'
7356

7457
# MD040: Explicitly only allow some languages for code blocks
7558
# This helps with consistency (e.g. avoid having both yml and yaml)
@@ -78,27 +61,94 @@ fenced-code-language:
7861
allowed_languages:
7962
- 'bash' # use this instead of shell or env
8063
- 'css'
64+
- 'diff'
8165
- 'graphql'
66+
- 'html'
8267
- 'js'
68+
- 'json'
8369
- 'php'
8470
- 'scss'
8571
- 'ss'
72+
- 'sql'
8673
- 'text'
74+
- 'xml'
8775
- 'yml'
8876

89-
# MD044: Enforces capitalisation for specific names
90-
proper-names:
77+
# MD044: Disable in favour of the enhanced version which ignores custom anchors for headings
78+
# markdownlint-rule-enhanced-proper-names: Enforces capitalisation for specific names
79+
proper-names: off
80+
enhanced-proper-names:
9181
code_blocks: false
82+
heading_id: false
9283
names:
84+
- 'API'
85+
- 'type/api-break' # the GitHub label
86+
- 'CI'
9387
- 'CMS'
88+
- '/cms' # e.g. "silverstripe/cms"
89+
- '-cms' # e.g. "silverstripe/recipe-cms"
9490
- 'CSS'
91+
- 'GitHub'
92+
- 'GraphQL'
93+
- '/graphql' # e.g. "silverstripe/graphql"
94+
- 'HTTP'
9595
- 'JavaScript'
9696
- 'JS'
97+
- '.js' # e.g. "Node.js"
98+
- 'jQuery'
99+
- 'ORM'
100+
- 'PHP'
101+
- 'php-' # e.g. "php-intl extension"
97102
- 'SCSS'
98103
- 'Silverstripe'
104+
- 'silverstripe/' # e.g. "silverstripe/framework"
105+
- 'silverstripe-' # e.g. "silverstripe-vendormodule"
106+
- '@silverstripe.org'
107+
- 'TinyMCE'
108+
- 'UI'
109+
- 'URL'
110+
- 'YAML'
111+
112+
# markdownlint-rule-title-case-style: Use sentence-style headings
113+
title-case-style:
114+
case: 'sentence'
115+
# commas in the following list are intentional and necessary since the plugin makes no distinction
116+
# between words and punctuation
117+
ignore:
118+
- 'Apache'
119+
- 'APIs'
120+
- 'Composer'
121+
- 'GitHub'
122+
- 'GraphQL'
123+
- 'Huntr'
124+
- 'JavaScript'
125+
- 'I'
126+
- 'InnoDB'
127+
- 'Git'
128+
- 'jQuery'
129+
- 'jQuery,'
130+
- 'Lighttpd'
131+
- 'MyISAM'
132+
- 'MySQL'
133+
- 'Nginx'
134+
- 'Nginx,'
135+
- 'PHPUnit'
136+
- 'RFCs'
137+
- 'Silverstripe'
138+
- 'TinyMCE'
139+
- 'Transifex'
140+
- 'URLs'
141+
- 'WebP'
99142

100143
# MD033: Allow specific HTML tags
101144
no-inline-html:
102145
allowed_elements:
146+
# br is necessary for new lines in tables
147+
- 'br'
148+
# accordians are okay
103149
- 'details'
104150
- 'summary'
151+
# description lists are okay
152+
- 'dl'
153+
- 'dd'
154+
- 'dt'

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222
],
2323
"require-dev": {
24-
"silverstripe/markdown-php-codesniffer": "^1.0",
24+
"silverstripe/markdown-php-codesniffer": "^1",
2525
"slevomat/coding-standard": "^8.14"
2626
},
2727
"config": {

0 commit comments

Comments
 (0)