-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Petter Walbø Johnsgård
committed
Jun 24, 2020
1 parent
531b367
commit 608d684
Showing
23 changed files
with
2,030 additions
and
10 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,10 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/vendor/ | ||
/composer.lock | ||
node_modules |
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 |
---|---|---|
@@ -1,12 +1,15 @@ | ||
{ | ||
"name": "dekodeinteraktiv/coding-standards", | ||
"description": "Dekode Coding Standards", | ||
"type": "phpcodesniffer-standard", | ||
"require": { | ||
"wp-coding-standards/wpcs": "^2.3", | ||
"phpcompatibility/phpcompatibility-wp": "^2.1", | ||
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2", | ||
"automattic/phpcs-neutron-standard": "^1.6" | ||
}, | ||
"license": "MIT" | ||
"name": "dekodeinteraktiv/coding-standards", | ||
"description": "Dekode Coding Standards", | ||
"type": "phpcodesniffer-standard", | ||
"require": { | ||
"wp-coding-standards/wpcs": "^2.3", | ||
"phpcompatibility/phpcompatibility-wp": "^2.1", | ||
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2", | ||
"automattic/phpcs-neutron-standard": "^1.6" | ||
}, | ||
"license": "MIT", | ||
"archive": { | ||
"exclude": [ "/packages" ] | ||
} | ||
} |
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 @@ | ||
{ | ||
"extends": "./lib/configs/base.js" | ||
} |
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 @@ | ||
.eslintrc |
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 @@ | ||
package-lock=false |
Empty file.
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Dekode Interaktiv AS | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,48 @@ | ||
# @dekode/eslint-plugin | ||
Dekodes's ESLint plugin, following our styleguide. | ||
|
||
## Installation | ||
You'll first need to install [ESLint](http://eslint.org): | ||
|
||
``` | ||
$ npm i eslint --save-dev | ||
``` | ||
|
||
Next, install [`@dekode/eslint-plugin`](https://github.com/DekodeInteraktiv/coding-standards/tree/master/packages/eslint-plugin): | ||
|
||
``` | ||
$ npm install @dekode/eslint-plugin --save-dev | ||
``` | ||
|
||
## Usage | ||
This plugin exports a [`base` config](index.js) that enforces best practices. | ||
|
||
Create your own `.eslintrc.js` configuration file: | ||
|
||
```js | ||
{ | ||
"extends": "plugin:@dekode/base", | ||
"plugins": [ | ||
"@dekode" | ||
] | ||
} | ||
``` | ||
|
||
Or see the [ESLint docs](http://eslint.org/docs/user-guide/configuring.html#configuration-file-formats) for more information about configuration file formats. | ||
|
||
You can also stack any of the extra shared configs on top of the "base" config by extending an array of linting configs. For example, this package provides a React linting config, which can be added to the base config with the following configuration file: | ||
|
||
```js | ||
{ | ||
"extends": [ | ||
"plugin:@dekode/base", | ||
"plugin:@dekode/react" | ||
] | ||
} | ||
``` | ||
|
||
## Available rulesets | ||
The following rulesets are available: | ||
|
||
* **base**: Enforces best practices and possible errors | ||
* **react**: Enforces best React.js practices |
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,6 @@ | ||
module.exports = { | ||
configs: { | ||
base: require( './lib/configs/base' ), | ||
react: require( './lib/configs/react' ), | ||
}, | ||
}; |
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,23 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
const merge = require( 'merge' ); | ||
|
||
module.exports = { | ||
plugins: [ | ||
'import', | ||
'jsx-a11y', | ||
'react', | ||
], | ||
rules: merge( | ||
require( './rules/best-practices' ), | ||
require( './rules/esnext' ), | ||
require( './rules/import' ), | ||
require( './rules/jsx-a11y' ), | ||
require( './rules/possible-errors' ), | ||
require( './rules/react' ), | ||
require( './rules/strict' ), | ||
require( './rules/stylistic-issues' ), | ||
require( './rules/variables' ), | ||
), | ||
}; |
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,28 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
const merge = require( 'merge' ); | ||
|
||
module.exports = { | ||
parser: 'babel-eslint', | ||
env: { | ||
browser: true, | ||
es6: true, | ||
jest: true, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
}, | ||
plugins: [ 'import' ], | ||
rules: merge( | ||
require( './rules/best-practices' ), | ||
require( './rules/esnext' ), | ||
require( './rules/import' ), | ||
require( './rules/possible-errors' ), | ||
require( './rules/strict' ), | ||
require( './rules/stylistic-issues' ), | ||
require( './rules/variables' ), | ||
), | ||
}; |
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,27 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
const merge = require( 'merge' ); | ||
|
||
module.exports = { | ||
plugins: [ | ||
'jsx-a11y', | ||
'react', | ||
'react-hooks', | ||
], | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
settings: { | ||
react: { | ||
pragma: 'React', | ||
version: '16', | ||
}, | ||
}, | ||
rules: merge( | ||
require( './rules/jsx-a11y' ), | ||
require( './rules/react' ), | ||
), | ||
}; |
Oops, something went wrong.