-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #387 from creative-commoners/pulls/4.13/linting
MNT Add linting
- Loading branch information
Showing
335 changed files
with
35,881 additions
and
31,824 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# For more information about the properties used in | ||
# this file, please see the EditorConfig documentation: | ||
# http://editorconfig.org/ | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[composer.json] | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const rules = require('@silverstripe/eslint-config/.eslintrc'); | ||
|
||
rules.plugins = ['markdown']; | ||
rules.overrides = [ | ||
{ | ||
files: ['**/*.md'], | ||
processor: 'markdown/markdown' | ||
}, | ||
{ | ||
files: ['**/*.md/*.js'], | ||
parserOptions: { | ||
ecmaFeatures: { | ||
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', | ||
} | ||
} | ||
]; | ||
|
||
module.exports = rules; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
# set fail-fast to false prevent one matrix job from cancelling other matrix jobs | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast | ||
fail-fast: false | ||
matrix: | ||
script: [ 'lint-md', 'lint-js', 'lint-php' ] | ||
name: ${{ matrix.script }} | ||
steps: | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
|
||
- name: Read .nvmrc | ||
id: read-nvm | ||
run: | | ||
NPM_VERSION=$(cat .nvmrc) | ||
echo "version=$NPM_VERSION" >> $GITHUB_OUTPUT | ||
- name: Install NPM | ||
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 | ||
with: | ||
node-version: ${{ steps.read-nvm.outputs.version }} | ||
|
||
- name: Install yarn dependencies | ||
run: | | ||
npm install --global yarn | ||
yarn install | ||
- name: Install PHP | ||
if: ${{ matrix.script == 'lint-php' }} | ||
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2.22.0 | ||
with: | ||
php-version: 8.1 | ||
|
||
- name: Install composer dependencies | ||
if: ${{ matrix.script == 'lint-php' }} | ||
run: composer install --prefer-dist --no-progress --ansi --no-interaction --optimize-autoloader | ||
|
||
- name: Run lint | ||
run: yarn ${{ matrix.script }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/node_modules/ | ||
/vendor/ | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
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': [ | ||
enhancedProperNames, | ||
titleCaseStyle, | ||
], | ||
'config': markdownlint.readConfigSync('./.markdownlint.yml', [ load ]), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# Enable all rules with default settings as a baseline | ||
default: true | ||
|
||
# MD041: Ignore the frontmatter (metadata) title when checking for H1s | ||
first-line-h1: | ||
front_matter_title: '' | ||
|
||
# MD025: Ignore the frontmatter (metadata) title when checking for H1s | ||
single-h1: | ||
front_matter_title: '' | ||
|
||
# MD003: Enforce ATX style headings | ||
heading-style: | ||
style: 'atx' | ||
|
||
# MD049: Use asterisks for italics | ||
emphasis-style: | ||
style: 'asterisk' | ||
|
||
# MD050: Use asterisks for bold | ||
strong-style: | ||
style: 'asterisk' | ||
|
||
# MD004: Use hyphens for unordered lists | ||
ul-style: | ||
style: 'dash' | ||
|
||
# MD029: Always use 1. for ordered lists | ||
ol-prefix: | ||
style: 'one' | ||
|
||
# MD013: Disable line-length rule for now as it touches too many lines of doc | ||
line-length: false | ||
# line_length: 120 | ||
|
||
# MD010: Use two spaces for each tab (default was 1) | ||
no-hard-tabs: | ||
spaces_per_tab: 2 | ||
|
||
# MD031: Don't require empty lines after code blocks in lists | ||
blanks-around-fences: | ||
list_items: false | ||
|
||
# MD035: Enforce a style for horizontal rules. | ||
# Hyphens would be confusing since we use those for frontmatter (metadata) | ||
hr-style: | ||
style: '___' | ||
|
||
# MD046: Don't allow indented codeblocks | ||
code-block-style: | ||
style: 'fenced' | ||
|
||
# MD048: Use backticks for codeblocks | ||
code-fence-style: | ||
style: 'backtick' | ||
|
||
# MD040: Explicitly only allow some languages for code blocks | ||
# This helps with consistency (e.g. avoid having both yml and yaml) | ||
fenced-code-language: | ||
language_only: true | ||
allowed_languages: | ||
- 'bash' # use this instead of shell or env | ||
- 'css' | ||
- 'diff' | ||
- 'graphql' | ||
- 'html' | ||
- 'js' | ||
- 'json' | ||
- 'php' | ||
- 'scss' | ||
- 'ss' | ||
- 'sql' | ||
- 'text' | ||
- 'xml' | ||
- 'yml' | ||
|
||
# MD044: Disable in favour of the enhanced version which ignores custom anchors for headings | ||
# markdownlint-rule-enhanced-proper-names: Enforces capitalisation for specific names | ||
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' | ||
|
||
# markdownlint-rule-title-case-style: Use sentence-style headings | ||
title-case-style: | ||
case: 'sentence' | ||
# commas in the following list are intentional and necessary since the plugin makes no distinction | ||
# between words and punctuation | ||
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' | ||
|
||
# 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.