Skip to content

Commit 923f5ae

Browse files
chore(eslint): customize eslint configuration for deck and add to package.json and webpack scripts
1 parent b6a426b commit 923f5ae

File tree

7 files changed

+33
-32
lines changed

7 files changed

+33
-32
lines changed

Diff for: .eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Built lib files
22
/**/modules/*/lib/**
3+
/**/*.spec.*

Diff for: .eslintrc

-29
This file was deleted.

Diff for: .eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
plugins: ['@spinnaker/eslint-plugin'],
3+
extends: ['plugin:@spinnaker/base'],
4+
};

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"scripts": {
1919
"clean": "rimraf .awcache .cache-loader build node_modules transpiled",
2020
"build": "NODE_OPTIONS=--max_old_space_size=8192 webpack --bail --progress --mode=production",
21-
"eslint": "eslint -c .eslintrc app/scripts/modules",
21+
"eslint": "eslint --ext js,jsx,ts,tsx -c .eslintrc.js app/scripts/modules",
2222
"start": "sh ./start.sh",
2323
"start-dev-server": "webpack-dev-server --progress --mode=development",
2424
"test": "karma start",
@@ -102,6 +102,7 @@
102102
"webpack-dev-middleware": "^3.7.2"
103103
},
104104
"devDependencies": {
105+
"@spinnaker/eslint-plugin": "./packages/eslint-plugin",
105106
"@types/angular": "1.6.26",
106107
"@types/angular-mocks": "1.5.10",
107108
"@types/angular-ui-bootstrap": "^0.13.41",

Diff for: packages/eslint-plugin/base.config.js

+21-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,27 @@ module.exports = {
22
parser: '@typescript-eslint/parser',
33
plugins: ['@typescript-eslint', '@spinnaker/eslint-plugin'],
44
extends: ['eslint:recommended', 'prettier', 'prettier/@typescript-eslint', 'plugin:@typescript-eslint/recommended'],
5-
rules: {},
5+
rules: {
6+
'@spinnaker/strictdi': 2,
7+
indent: 'off',
8+
'member-ordering': 'off',
9+
'no-console': ['error', { allow: ['warn', 'error'] }],
10+
'no-extra-boolean-cast': 'off',
11+
'@typescript-eslint/array-type': ['error', 'array-simple'],
12+
'@typescript-eslint/explicit-function-return-type': 'off',
13+
'@typescript-eslint/explicit-member-accessibility': 'off',
14+
'@typescript-eslint/indent': 'off',
15+
'@typescript-eslint/interface-name-prefix': 'off',
16+
'@typescript-eslint/no-case-declarations': 'off',
17+
'@typescript-eslint/no-empty-interface': 'off',
18+
'@typescript-eslint/no-explicit-any': 'off',
19+
'@typescript-eslint/no-object-literal-type-assertion': 'off',
20+
'@typescript-eslint/no-parameter-properties': 'off',
21+
'@typescript-eslint/no-triple-slash-reference': 'off',
22+
'@typescript-eslint/no-unused-vars': 'off',
23+
'@typescript-eslint/no-use-before-define': 'off',
24+
'@typescript-eslint/no-var-requires': 'off', // TODO: turn on?
25+
},
626
overrides: [
727
{
828
files: ['*.js', '*.jsx'],

Diff for: webpack.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function configure(env, webpackOpts) {
1717
const WEBPACK_MODE = (webpackOpts && webpackOpts.mode) || 'development';
1818
const IS_PRODUCTION = WEBPACK_MODE === 'production';
1919

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

2223
const config = {
@@ -130,7 +131,7 @@ function configure(env, webpackOpts) {
130131
{ loader: 'cache-loader', options: { cacheIdentifier: CACHE_INVALIDATE } },
131132
{ loader: 'thread-loader', options: { workers: THREADS } },
132133
{ loader: 'ts-loader', options: { happyPackMode: true } },
133-
{ loader: 'tslint-loader' },
134+
{ loader: 'eslint-loader' },
134135
],
135136
exclude: /node_modules/,
136137
},

Diff for: yarn.lock

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
dependencies:
4545
tinyqueue "^1.1.0"
4646

47+
"@spinnaker/eslint-plugin@./packages/eslint-plugin":
48+
version "1.0.5"
49+
4750
"@spinnaker/[email protected]":
4851
version "0.0.88"
4952
resolved "https://registry.yarnpkg.com/@spinnaker/kayenta/-/kayenta-0.0.88.tgz#6a8f33dd9d704d0e35673626441c737aa2517832"

0 commit comments

Comments
 (0)