Skip to content

Commit

Permalink
Merge branch 'master' into a-fh
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Oct 4, 2021
2 parents c759e49 + f053af1 commit 2514f76
Show file tree
Hide file tree
Showing 2,177 changed files with 128,744 additions and 12,774 deletions.
215 changes: 215 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
plugins: ['jsdoc', 'regexp'],
extends: 'eslint:recommended',
rules: {
'no-use-before-define': ['error', { 'functions': false, 'classes': false }],

// stylistic rules
'brace-style': ['warn', '1tbs', { allowSingleLine: true }],
'curly': ['warn', 'all'],
'eol-last': 'warn',
'no-multiple-empty-lines': ['warn', { max: 2, maxBOF: 0, maxEOF: 0 }],
'no-tabs': ['warn', { allowIndentationTabs: true }],
'no-var': 'error',
'one-var': ['warn', 'never'],
'quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'semi': 'warn',
'wrap-iife': 'warn',

// spaces and indentation
'arrow-spacing': 'warn',
'block-spacing': 'warn',
'comma-spacing': 'warn',
'computed-property-spacing': 'warn',
'func-call-spacing': 'warn',
'generator-star-spacing': 'warn',
'indent': ['warn', 'tab', { SwitchCase: 1 }],
'key-spacing': 'warn',
'keyword-spacing': 'warn',
'no-multi-spaces': ['warn', { ignoreEOLComments: true }],
'no-trailing-spaces': 'warn',
'no-whitespace-before-property': 'warn',
'object-curly-spacing': ['warn', 'always'],
'rest-spread-spacing': 'warn',
'semi-spacing': 'warn',
'space-before-blocks': 'warn',
'space-before-function-paren': ['warn', { named: 'never' }],
'space-in-parens': 'warn',
'space-infix-ops': ['warn', { int32Hint: true }],
'space-unary-ops': 'warn',
'switch-colon-spacing': 'warn',
'template-curly-spacing': 'warn',
'yield-star-spacing': 'warn',

// JSDoc
'jsdoc/check-alignment': 'warn',
'jsdoc/check-syntax': 'warn',
'jsdoc/check-param-names': 'warn',
'jsdoc/require-hyphen-before-param-description': ['warn', 'never'],
'jsdoc/check-tag-names': 'warn',
'jsdoc/check-types': 'warn',
'jsdoc/empty-tags': 'warn',
'jsdoc/newline-after-description': 'warn',
'jsdoc/require-param-name': 'warn',
'jsdoc/require-property-name': 'warn',

// regexp
'regexp/no-dupe-disjunctions': 'error',
'regexp/no-empty-alternative': 'error',
'regexp/no-empty-capturing-group': 'error',
'regexp/no-empty-lookarounds-assertion': 'error',
'regexp/no-lazy-ends': 'error',
'regexp/no-obscure-range': 'error',
'regexp/no-optional-assertion': 'error',
'regexp/no-standalone-backslash': 'error',
'regexp/no-super-linear-backtracking': 'error',
'regexp/no-unused-capturing-group': 'error',
'regexp/no-zero-quantifier': 'error',
'regexp/optimal-lookaround-quantifier': 'error',

'regexp/match-any': 'warn',
'regexp/negation': 'warn',
'regexp/no-dupe-characters-character-class': 'warn',
'regexp/no-trivially-nested-assertion': 'warn',
'regexp/no-trivially-nested-quantifier': 'warn',
'regexp/no-useless-character-class': 'warn',
'regexp/no-useless-lazy': 'warn',
'regexp/prefer-w': 'warn',
'regexp/sort-alternatives': 'warn',
'regexp/sort-flags': 'warn',
'regexp/strict': 'warn',

// I turned this rule off because we use `hasOwnProperty` in a lot of places
// TODO: Think about re-enabling this rule
'no-prototype-builtins': 'off',
// TODO: Think about re-enabling this rule
'no-inner-declarations': 'off',
// TODO: Think about re-enabling this rule
'no-sparse-arrays': 'off',

// turning off some regex rules
// these are supposed to protect against accidental use but we need those quite often
'no-control-regex': 'off',
'no-empty-character-class': 'off',
'no-useless-escape': 'off'
},
settings: {
jsdoc: { mode: 'typescript' },
regexp: {
// allow alphanumeric and cyrillic ranges
allowedCharacterRanges: ['alphanumeric', 'а-я', 'А-Я']
}
},
ignorePatterns: [
'*.min.js',
'vendor/',
'docs/',
'components.js',
'prism.js',
'node_modules'
],

overrides: [
{
// Languages and plugins
files: [
'components/*.js',
'plugins/*/prism-*.js'
],
excludedFiles: 'components/index.js',
env: {
browser: true,
node: true,
worker: true
},
globals: {
'Prism': true
},
rules: {
'no-var': 'off'
}
},
{
// `loadLanguages` function for Node.js
files: 'components/index.js',
env: {
es6: true,
node: true
},
parserOptions: {
ecmaVersion: 6
},
globals: {
'Prism': true
}
},
{
// Gulp and Danger
files: 'dependencies.js',
env: {
browser: true,
node: true
},
rules: {
'no-var': 'off'
}
},
{
// The scripts that run on our website
files: 'assets/*.js',
env: {
browser: true
},
globals: {
'components': true,
'getLoader': true,
'PrefixFree': true,
'Prism': true,
'Promise': true,
'saveAs': true,
'$': true,
'$$': true,
'$u': true
},
rules: {
'no-var': 'off'
}
},
{
// Test files
files: 'tests/**',
env: {
es6: true,
mocha: true,
node: true
},
parserOptions: {
ecmaVersion: 2018
}
},
{
// Gulp, Danger, and benchmark
files: [
'gulpfile.js/**',
'dangerfile.js',
'benchmark/**',
],
env: {
es6: true,
node: true
},
parserOptions: {
ecmaVersion: 2018
}
},
{
// This file
files: '.eslintrc.js',
env: {
node: true
}
},
]
};
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
* text=auto

# Test files should not have their line endings modified by git
/tests/languages/**/*.test binary
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ assignees: ''

**Information:**
- Prism version: [e.g. 1.14, latest from the download page, etc.]
- Plugins: [a list of plugins you are using or 'none']
- Environment: [e.g. Browser, Node, Webpack]

<!--
Does the latest version of Prism from the [download page](https://prismjs.com/download.html) also have this issue?
If you're using Prism with Node or Webpack, please also see the [usage section](https://prismjs.com/index.html#basic-usage).
-->

**Description**
A clear and concise description of what the bug is and how to reproduce it.
Expand Down
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
contact_links:
- name: Questions and Help
url: https://github.com/PrismJS/prism/discussions/categories/q-a
about: This issue tracker is not for support questions. Please refer to the Prism's Discussion tab.
13 changes: 11 additions & 2 deletions .github/ISSUE_TEMPLATE/highlighting-bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,24 @@ assignees: ''

**Information**
- Language: [e.g. C++, JavaScript, YAML, etc.]
- Plugins: [what plugin you are using]
- Plugins: [a list of plugins you are using or 'none']

Does the problem still occur in the latest version of Prism? You can check using the [test page](https://prismjs.com/test.html) or get the latest version at the [download page](https://prismjs.com/download.html).
<!--
Please verify that the problem still occurs in the latest version of Prism.
You can check this using the [test page](https://prismjs.com/test.html) or by getting the latest version at our [download page](https://prismjs.com/download.html).
-->

**Description**
A clear and concise description of what is being highlighted incorrectly and how it should be highlighted instead. Add screenshots to illustrate the problem.

**Code snippet**

<!--
Please add a link to the [test page](https://prismjs.com/test.html) that reproduces your issue (hover over "Share" and insert the link below).
-->
[Test page]()

<details>
<summary>The code being highlighted incorrectly.</summary>

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/new-language-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: New language request
about: Suggest a new language Prism should support.
title: ''
labels: language-definitions, new langauge
labels: language-definitions, new language
assignees: ''

---
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Danger

on:
pull_request_target:

jobs:
run:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
with:
fetch-depth: 0
# create a new branch called pr from the remote PR branch
- run: git remote add pr_repo $PR_URL && git fetch pr_repo $PR_REF && git branch pr pr_repo/$PR_REF
env:
PR_URL: ${{github.event.pull_request.head.repo.clone_url}}
PR_REF: ${{github.event.pull_request.head.ref}}
- run: npm ci
- name: Danger
run: npx danger ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 changes: 59 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
tests:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test

build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- run: |
git add --all && \
git diff-index --cached HEAD --stat --exit-code || \
(echo && echo "The above files changed because the build is not up to date." && echo "Please rebuild Prism." && exit 1)
lint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm ci
- run: npm run lint:ci
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ hide-*.js
node_modules
.idea/
.DS_Store
.eslintcache

benchmark/remotes/
benchmark/downloads/
Loading

0 comments on commit 2514f76

Please sign in to comment.