Skip to content

Commit

Permalink
MNT Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Nov 9, 2023
1 parent 4f79962 commit 2f45e56
Show file tree
Hide file tree
Showing 333 changed files with 13,219 additions and 11,901 deletions.
5 changes: 1 addition & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[composer.json]
indent_size = 4
indent_size = 4
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,24 @@ rules.overrides = [
impliedStrict: true
}
},
settings: {
react: {
version: '16'
}
},
rules: {
// These rules are not appropriate for linting markdown code blocks
'lines-around-comment': 'off',
'import/no-unresolved': 'off',
'import/extensions': 'off',
'react/jsx-no-undef': 'off',
'no-undef': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'brace-style': 'off', // it's useful to have comments before the else block
// These rules are disabled because they are difficult to adhere to right now
'jsx-a11y/label-has-associated-control': 'off',
'react/prefer-stateless-function': 'off',
}
}
];
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
node-version: ${{ steps.read-nvm.outputs.version }}

- name: Install yarn and dependencies
- name: Install yarn dependencies
run: |
npm install --global yarn
yarn install
Expand All @@ -44,7 +44,7 @@ jobs:

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

- name: Run lint
run: yarn ${{ matrix.script }}
6 changes: 5 additions & 1 deletion .markdownlint-cli2.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

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

export default {
'customRules': [ titleCaseStyle ],
'customRules': [
enhancedProperNames,
titleCaseStyle,
],
'config': markdownlint.readConfigSync('./.markdownlint.yml', [ load ]),
};
58 changes: 53 additions & 5 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
# Enable all rules with default settings as a baseline
default: true

customRules:
- 'markdownlint-rule-title-case-style'

# markdownlint-rule-title-case-style: Use sentence-style headings
title-case-style:
case: 'sentence'
ignore:
- 'Apache'
- 'APIs'
- 'Composer'
- 'GitHub'
- 'GraphQL'
- 'Huntr'
- 'JavaScript'
- 'I'
- 'InnoDB'
- 'Git'
- 'jQuery'
- 'jQuery,'
- 'Lighttpd'
- 'MyISAM'
- 'MySQL'
- 'Nginx'
- 'Nginx,'
- 'PHPUnit'
- 'RFCs'
- 'Silverstripe'
- 'TinyMCE'
- 'Transifex'
- 'URLs'
- 'WebP'

# MD041: Ignore the frontmatter (metadata) title when checking for H1s
first-line-h1:
Expand Down Expand Up @@ -46,7 +58,7 @@ ul-style:
ol-prefix:
style: 'one'

# MD013: Disable line-length rule (for now)
# MD013: Disable line-length rule for now as it touches too many lines of doc
line-length: false
# line_length: 120

Expand Down Expand Up @@ -78,27 +90,63 @@ fenced-code-language:
allowed_languages:
- 'bash' # use this instead of shell or env
- 'css'
- 'diff'
- 'graphql'
- 'html'
- 'js'
- 'json'
- 'php'
- 'scss'
- 'ss'
- 'sql'
- 'text'
- 'xml'
- 'yml'

# MD044: Enforces capitalisation for specific names
proper-names:
# Replaced with the ehnanced version which ignores custom anchors for headings
proper-names: off
enhanced-proper-names:
code_blocks: false
heading_id: false
names:
- 'API'
- 'type/api-break' # the GitHub label
- 'CI'
- 'CMS'
- '/cms' # e.g. "silverstripe/cms"
- '-cms' # e.g. "silverstripe/recipe-cms"
- 'CSS'
- 'GitHub'
- 'GraphQL'
- '/graphql' # e.g. "silverstripe/graphql"
- 'HTTP'
- 'JavaScript'
- 'JS'
- '.js' # e.g. "Node.js"
- 'jQuery'
- 'ORM'
- 'PHP'
- 'php-' # e.g. "php-intl extension"
- 'SCSS'
- 'Silverstripe'
- 'silverstripe/' # e.g. "silverstripe/framework"
- 'silverstripe-' # e.g. "silverstripe-vendormodule"
- '@silverstripe.org'
- 'TinyMCE'
- 'UI'
- 'URL'
- 'YAML'

# MD033: Allow specific HTML tags
no-inline-html:
allowed_elements:
# br is necessary for new lines in tables
- 'br'
# accordians are okay
- 'details'
- 'summary'
# description lists are okay
- 'dl'
- 'dd'
- 'dt'
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@
}
],
"require-dev": {
"silverstripe/markdown-php-codesniffer": "dev-pulls/1/new-repo"
"silverstripe/markdown-php-codesniffer": "dev-pulls/1/new-repo",
"slevomat/coding-standard": "^8.14"
},
"repositories": [
{
"url": "https://github.com/creative-commoners/markdown-php-codesniffer",
"type": "vcs"
}
]
],
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
Loading

0 comments on commit 2f45e56

Please sign in to comment.