Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Ruff committed Feb 15, 2018
0 parents commit 9903c9d
Show file tree
Hide file tree
Showing 10 changed files with 3,275 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"env": {
"node": true,
"es6": true,
"jest/globals": true
},
"plugins": ["jest"],
"extends": "./src/index.js"
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
coverage
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v8
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sudo: false
language: node_js
node_js:
- "8"
cache:
directories:
- node_modules
notifications:
email: false
install:
- yarn install
script:
- yarn lint
- yarn test --coverage
branches:
except:
- /^v\d+\.\d+\.\d+$/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Immowelt Hamburg

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.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# @immowelt/eslint-config-immowelt-es5

[![Powered by Immowelt](https://img.shields.io/badge/powered%20by-immowelt-yellow.svg?colorB=ffb200)](https://stackshare.io/immowelt-group/)
[![Build Status](https://travis-ci.org/ImmoweltGroup/eslint-config-immowelt-es5.svg?branch=master)](https://travis-ci.org/ImmoweltGroup/eslint-config-immowelt-es5)
[![Dependency Status](https://david-dm.org/ImmoweltGroup/eslint-config-immowelt-es5.svg)](https://david-dm.org/ImmoweltGroup/eslint-config-immowelt-es5)
[![devDependency Status](https://david-dm.org/ImmoweltGroup/eslint-config-immowelt-es5/dev-status.svg)](https://david-dm.org/ImmoweltGroup/eslint-config-immowelt-es5#info=devDependencies&view=table)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovateapp.com/)

This package servers as the basis for the JavaScript standards of the Immowelt GmbH.

It sets a bunch of rules and warnings for best practices on how to write a maintainable JavaScript code base, as well as hints on how to write a good performing es5 application.

## Usage

If you want to use the `@immowelt/eslint-config-immowelt-es5` config, you can install it by executing:

```bash
npm i -D @immowelt/eslint-config-immowelt-es5
```

Then create a file named `.eslintrc` with following contents in the root folder of your project:

```json
{
"extends": "@immowelt/eslint-config-immowelt-es5"
}
```

## Licensing
See the `LICENSE` file at the root of the repository.
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "eslint-config-immowelt-es5",
"version": "0.0.0",
"description": "JavaScript Standard Style For Immowelt ES5 Projects - ESLint Shareable Config",
"main": "index.js",
"author": "Immonet dev team <aegaeon@immonet.de> (https://www.immowelt.de)",
"license": "MIT",
"homepage": "https://github.com/ImmoweltGroup/eslint-config-immowelt-es5#readme",
"bugs": {
"url": "https://github.com/ImmoweltGroup/eslint-config-immowelt-es5/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ImmoweltGroup/eslint-config-immowelt-es5.git"
},
"keywords": [
"eslint",
"immowelt",
"config",
"immonet"
],
"scripts": {
"lint": "eslint \"src/**/*.js\"",
"test": "jest"
},
"devDependencies": {
"eslint": "^4.17.0",
"eslint-plugin-jest": "^21.12.1",
"jest": "^22.3.0"
}
}
72 changes: 72 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
module.exports = {
extends: 'eslint:recommended',
env: {
browser: true,
jquery: true
},
globals: {
'enquire': true,
'dataLayer': true,
'_gaq': true,
'TINY': true,
'trackSearchAgent': true
},
rules: {
'array-bracket-spacing': 'error',
'brace-style': 'error',
'comma-style': 'error',
'dot-notation': 'error',
'eol-last': 'error',
'eqeqeq': [
'error',
'smart'
],
'indent': [
'error',
2
],
'keyword-spacing': 'error',
'linebreak-style': 'error',
'newline-per-chained-call': 'error',
'no-array-constructor': 'error',
'no-console': [
'error',
{
'allow': [
'error',
'warn'
]
}
],
'no-dupe-class-members': 'error',
'no-else-return': 'error',
'no-eval': 'error',
'no-loop-func': 'error',
'no-mixed-operators': 'error',
'no-nested-ternary': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-wrappers': 'error',
'no-unneeded-ternary': 'error',
'nonblock-statement-body-position': 'error',
'object-curly-spacing': 'error',
'padded-blocks': [
'error',
'never'
],
'quote-props': [
'error',
'consistent'
],
'quotes': [
'error',
'single'
],
'semi': 'error',
'space-before-blocks': 'error',
'space-before-function-paren': 'error',
'space-in-parens': 'error',
'space-infix-ops': 'error',
'spaced-comment': 'error'
}
};
22 changes: 22 additions & 0 deletions src/index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const {linter} = require('eslint');
const config = require('./index.js');

const runEslint = str => linter.verify(str, config, {filename: 'foo.js'});

describe('eslint-config-immowelt-es5', () => {
it('should export a valid eslint config object structure.', () => {
expect(typeof config).toBe('object');
});

it('should not throw errors when checking a valid code fixture.', () => {
const errors = runEslint(`var x = true;
if (x) {
console.warn('warning');
}
`);

expect(errors).toEqual([]);
});
});
Loading

0 comments on commit 9903c9d

Please sign in to comment.