Skip to content

Commit

Permalink
chore: add custom eslint rule for adding license-checks (#141)
Browse files Browse the repository at this point in the history
* chore: add custom eslint rule for adding license-checks

* move standard & prettier as plugin
  • Loading branch information
vigneshshanmugam authored and jahtalab committed Jan 18, 2019
1 parent 537bf19 commit df51d21
Show file tree
Hide file tree
Showing 34 changed files with 1,237 additions and 1,451 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{md,asciidoc}]
trim_trailing_whitespace = false
insert_final_newline = false
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build
docs
coverage
dist
*.e2e-bundle.*
test/e2e/sourcemap
43 changes: 34 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
const { readFileSync } = require('fs')
const { join } = require('path')
/**
* Helps with using custom eslint rules without creating and publishing as plugin
*/
const rulesDirPlugin = require('eslint-plugin-rulesdir')
rulesDirPlugin.RULES_DIR = join(__dirname, 'scripts/eslint-rules')

const MIT_LICENSE = readFileSync('./LICENSE', 'utf-8')
const LICENSE_HEADER =
'/**\n' +
MIT_LICENSE.split('\n')
.map(line => ` * ${line}`)
.join('\n') +
'\n */'

module.exports = {
"env": {
"es6": true
},
"rules": {
"max-len": ["error", { "code": 100 }],
'no-unused-vars': 'error',
'space-before-function-paren': 'error'
}
}
env: {
es6: true,
browser: true
},
parser: 'babel-eslint',
plugins: ['prettier', 'standard', 'rulesdir'],
rules: {
'max-len': ['error', { code: 100, ignoreComments: true }],
'no-unused-vars': 'error',
'space-before-function-paren': 'error',
'rulesdir/require-license-header': [
'error',
{
license: LICENSE_HEADER
}
]
}
}
25 changes: 25 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/**
* MIT License
*
* Copyright (c) 2017-present, Elasticsearch BV
*
* 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.
*
*/

module.exports = function (api) {
api.cache(true)
return {
Expand Down
25 changes: 25 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/**
* MIT License
*
* Copyright (c) 2017-present, Elasticsearch BV
*
* 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.
*
*/

var karmaUtils = require('elastic-apm-js-core/dev-utils/karma.js')

module.exports = function (config) {
Expand Down
Loading

0 comments on commit df51d21

Please sign in to comment.