Skip to content

Commit

Permalink
chore(eslint): customize eslint configuration for deck and add to pac…
Browse files Browse the repository at this point in the history
…kage.json and webpack scripts
  • Loading branch information
christopherthielen committed Dec 13, 2019
1 parent b6a426b commit 923f5ae
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 32 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Built lib files
/**/modules/*/lib/**
/**/*.spec.*
29 changes: 0 additions & 29 deletions .eslintrc

This file was deleted.

4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
plugins: ['@spinnaker/eslint-plugin'],
extends: ['plugin:@spinnaker/base'],
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"clean": "rimraf .awcache .cache-loader build node_modules transpiled",
"build": "NODE_OPTIONS=--max_old_space_size=8192 webpack --bail --progress --mode=production",
"eslint": "eslint -c .eslintrc app/scripts/modules",
"eslint": "eslint --ext js,jsx,ts,tsx -c .eslintrc.js app/scripts/modules",
"start": "sh ./start.sh",
"start-dev-server": "webpack-dev-server --progress --mode=development",
"test": "karma start",
Expand Down Expand Up @@ -102,6 +102,7 @@
"webpack-dev-middleware": "^3.7.2"
},
"devDependencies": {
"@spinnaker/eslint-plugin": "./packages/eslint-plugin",
"@types/angular": "1.6.26",
"@types/angular-mocks": "1.5.10",
"@types/angular-ui-bootstrap": "^0.13.41",
Expand Down
22 changes: 21 additions & 1 deletion packages/eslint-plugin/base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,27 @@ module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', '@spinnaker/eslint-plugin'],
extends: ['eslint:recommended', 'prettier', 'prettier/@typescript-eslint', 'plugin:@typescript-eslint/recommended'],
rules: {},
rules: {
'@spinnaker/strictdi': 2,
indent: 'off',
'member-ordering': 'off',
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-extra-boolean-cast': 'off',
'@typescript-eslint/array-type': ['error', 'array-simple'],
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/no-case-declarations': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-object-literal-type-assertion': 'off',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-triple-slash-reference': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'off', // TODO: turn on?
},
overrides: [
{
files: ['*.js', '*.jsx'],
Expand Down
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function configure(env, webpackOpts) {
const WEBPACK_MODE = (webpackOpts && webpackOpts.mode) || 'development';
const IS_PRODUCTION = WEBPACK_MODE === 'production';

// eslint-disable-next-line no-console
console.log('Webpack mode: ' + WEBPACK_MODE);

const config = {
Expand Down Expand Up @@ -130,7 +131,7 @@ function configure(env, webpackOpts) {
{ loader: 'cache-loader', options: { cacheIdentifier: CACHE_INVALIDATE } },
{ loader: 'thread-loader', options: { workers: THREADS } },
{ loader: 'ts-loader', options: { happyPackMode: true } },
{ loader: 'tslint-loader' },
{ loader: 'eslint-loader' },
],
exclude: /node_modules/,
},
Expand Down
3 changes: 3 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
dependencies:
tinyqueue "^1.1.0"

"@spinnaker/eslint-plugin@./packages/eslint-plugin":
version "1.0.5"

"@spinnaker/kayenta@0.0.88":
version "0.0.88"
resolved "https://registry.yarnpkg.com/@spinnaker/kayenta/-/kayenta-0.0.88.tgz#6a8f33dd9d704d0e35673626441c737aa2517832"
Expand Down

0 comments on commit 923f5ae

Please sign in to comment.