Skip to content

Commit

Permalink
fix: prettier & linter use the same config.
Browse files Browse the repository at this point in the history
  • Loading branch information
svrnm committed Sep 27, 2022
1 parent 9199a78 commit f15e91c
Show file tree
Hide file tree
Showing 122 changed files with 14,730 additions and 8,451 deletions.
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"presets": ["@babel/preset-react", "@babel/preset-env"],
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-transform-runtime"]
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime"
]
}
34 changes: 23 additions & 11 deletions .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [1, 'always', 72],
'header-full-stop': [2, 'always'],
'subject-full-stop': [0, 'always'],
'type-enum': [
2,
'always',
['build', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'style', 'test', 'revert', 'version']
]
}
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [1, 'always', 72],
'header-full-stop': [2, 'always'],
'subject-full-stop': [0, 'always'],
'type-enum': [
2,
'always',
[
'build',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'style',
'test',
'revert',
'version'
]
]
}
}
35 changes: 19 additions & 16 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,32 @@
"plugin:import/errors",
"plugin:import/warnings"
],
"plugins": [
"promise",
"json",
"react",
"import",
"header"
],
"plugins": ["promise", "json", "react", "import", "header"],
"env": {
"browser": true,
"node": true,
"mocha": true
},
"rules": {
"react/jsx-uses-vars": 1,
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "ignore",
"asyncArrow": "ignore"
}],
"header/header": [2, "block", [{
"pattern": "\\* Licensed under the Apache License, Version 2\\.0 \\(the \"License\"\\);[\\r\\n]+ \\* you may not use this file except in compliance with the License\\.[\\r\\n]+ \\* You may obtain a copy of the License at[\\r\\n]+ \\*[\\r\\n]+ \\* https:\\/\\/www\\.apache\\.org\\/licenses\\/LICENSE-2\\.0[\\r\\n]+ \\*[\\r\\n]+ \\* Unless required by applicable law or agreed to in writing, software[\\r\\n]+ \\* distributed under the License is distributed on an \"AS IS\" BASIS,[\\r\\n]+ \\* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\\.[\\r\\n]+ \\* See the License for the specific language governing permissions and[\\r\\n]+ \\* limitations under the License\\.",
"template": "*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n "
}]]
"space-before-function-paren": [
"error",
{
"anonymous": "always",
"named": "ignore",
"asyncArrow": "ignore"
}
],
"header/header": [
2,
"block",
[
{
"pattern": "\\* Licensed under the Apache License, Version 2\\.0 \\(the \"License\"\\);[\\r\\n]+ \\* you may not use this file except in compliance with the License\\.[\\r\\n]+ \\* You may obtain a copy of the License at[\\r\\n]+ \\*[\\r\\n]+ \\* https:\\/\\/www\\.apache\\.org\\/licenses\\/LICENSE-2\\.0[\\r\\n]+ \\*[\\r\\n]+ \\* Unless required by applicable law or agreed to in writing, software[\\r\\n]+ \\* distributed under the License is distributed on an \"AS IS\" BASIS,[\\r\\n]+ \\* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\\.[\\r\\n]+ \\* See the License for the specific language governing permissions and[\\r\\n]+ \\* limitations under the License\\.",
"template": "*\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n "
}
]
]
},
"settings": {
"react": {
Expand Down
10 changes: 5 additions & 5 deletions .markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"default": true,
"MD013": {
"line_length": 120
}
}
"default": true,
"MD013": {
"line_length": 120
}
}
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "none"
}
20 changes: 9 additions & 11 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ It also provides a step by step guide to add custom commands.

## Setup Environment

Before you start, make sure you have *nodejs*, *webpack* and *mocha* installed.
Before you start, make sure you have _nodejs_, _webpack_ and _mocha_ installed.

To get started, you need to checkout the latest development version via git:

Expand All @@ -18,7 +18,7 @@ git clone https://github.com/svrnm/demomonkey.git
cd demomonkey
```

Now, you need to download and install all dependencies for your development environment:
Now, you need to download and install all dependencies for your development environment:

```shell
npm install
Expand Down Expand Up @@ -46,7 +46,7 @@ Likely, the first thing you want to do, is adding a custom command to DemoMonkey
customisations for your demo. In the following you will learn how to build such a custom command step by step.

Let's start with a helloworld example. The goal of this first exercise is creating a command `!helloworld()` that just
replaces *all* text on the website with `hello world`.
replaces _all_ text on the website with `hello world`.

First, create an empty file called `HelloWorld.js` in the folder `src/commands`. Next add the following code:

Expand All @@ -55,9 +55,9 @@ import Command from './Command'

class HelloWorld extends Command {
apply(target, key) {
target[key] = 'hello world'
target[key] = 'hello world'
return false
}
}
}

export default HelloWorld
Expand All @@ -71,7 +71,7 @@ import HelloWorld from './HelloWorld'
```

Afterward add the following within the method body of `_buildCustomCommand` right before the comment
`// Add new commands above this line.`:
`// Add new commands above this line.`:

```javascript
if (command === 'helloWorld') {
Expand Down Expand Up @@ -112,7 +112,6 @@ First, adding parameters to your command is easy. Just add a constructor to your
import Command from './Command'

class HelloWorld extends Command {

constructor(hello, world) {
super()
this.hello = hello
Expand All @@ -122,7 +121,7 @@ class HelloWorld extends Command {
apply(target, key) {
target[key] = this.hello + ' ' + this.world
return false
}
}
}

export default HelloWorld
Expand All @@ -143,7 +142,7 @@ Reload your extension and update your demo configuration to
!helloWorld(hallo) = welt
```

Now, reloading your demo page, you should see *hallo welt* everywhere instead of *hello world*.
Now, reloading your demo page, you should see _hallo welt_ everywhere instead of _hello world_.

If you need further parameters `parameters[1], ..., parameters[n]`, just add them to your constructor and to the
`CommandBuilder.js` as needed.
Expand All @@ -155,7 +154,6 @@ import Command from './Command'
import UndoElement from './UndoElement'

class HelloWorld extends Command {

constructor(hello, world) {
super()
this.hello = hello
Expand All @@ -170,7 +168,7 @@ class HelloWorld extends Command {
return new UndoElement(target, key, original, replacement)
}
return false
}
}
}

export default HelloWorld
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ flight booking service.

## Usage

DemoMonkey is driven by __configurations__, that contain replace patterns in the following format:
DemoMonkey is driven by **configurations**, that contain replace patterns in the following format:

```ini
eCommerce = Booking Service
Expand Down
Loading

0 comments on commit f15e91c

Please sign in to comment.