Skip to content

Commit

Permalink
Merge branch '4' into 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Nov 30, 2023
2 parents eb93da0 + d4be6d4 commit 87e27db
Show file tree
Hide file tree
Showing 245 changed files with 17,492 additions and 13,492 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
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
38 changes: 38 additions & 0 deletions .eslintrc.js
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;
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
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 }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules/
/vendor/
composer.lock
13 changes: 13 additions & 0 deletions .markdownlint-cli2.mjs
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 ]),
};
154 changes: 154 additions & 0 deletions .markdownlint.yml
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'
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
11 changes: 10 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,14 @@
"name": "The SilverStripe Community",
"homepage": "https://silverstripe.org"
}
]
],
"require-dev": {
"silverstripe/markdown-php-codesniffer": "^1",
"slevomat/coding-standard": "^8.14"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
Loading

0 comments on commit 87e27db

Please sign in to comment.