Skip to content

Commit

Permalink
chore: make sure eslint can find the plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed Feb 27, 2019
1 parent a3f3383 commit d0e6556
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
@@ -1,3 +1,3 @@
module.exports = {
extends: ['./packages/build/config/.eslintrc.js'],
extends: ['./packages/eslint-config/index.js'],
};
23 changes: 16 additions & 7 deletions bin/sync-dev-deps.js
Expand Up @@ -25,19 +25,28 @@ async function syncDevDeps() {
const buildDeps = require(path.join(rootPath, 'packages/build/package.json'))
.dependencies;

const masterDeps = {
typescript: buildDeps.typescript,
eslint: buildDeps.eslint,
};
const deps = [
'typescript',
'eslint',
'@typescript-eslint/eslint-plugin',
'@typescript-eslint/parser',
'eslint-plugin-eslint-plugin',
];
const masterDeps = {};
for (const d of deps) {
masterDeps[d] = buildDeps[d];
}

// Update typescript & eslint dependencies in individual packages
for (const pkg of packages) {
const data = readJsonFile(pkg.manifestLocation);
let modified = false;
for (const dep in masterDeps) {
if (data.devDependencies && dep in data.devDependencies) {
data.devDependencies[dep] = masterDeps[dep];
modified = true;
if (data.devDependencies && data.devDependencies[dep]) {
if (data.devDependencies[dep] !== masterDeps[dep]) {
data.devDependencies[dep] = masterDeps[dep];
modified = true;
}
}
}
if (!modified) continue;
Expand Down
5 changes: 4 additions & 1 deletion examples/hello-world/package.json
Expand Up @@ -46,7 +46,10 @@
"@loopback/eslint-config": "^1.0.0-1",
"@types/node": "^10.11.2",
"eslint": "^5.14.1",
"typescript": "^3.3.1"
"typescript": "^3.3.1",
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.4.2",
"eslint-plugin-eslint-plugin": "^2.0.1"
},
"keywords": [
"loopback",
Expand Down
5 changes: 4 additions & 1 deletion examples/log-extension/package.json
Expand Up @@ -48,7 +48,10 @@
"@types/debug": "^4.1.0",
"@types/node": "^10.11.2",
"eslint": "^5.14.1",
"typescript": "^3.3.1"
"typescript": "^3.3.1",
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.4.2",
"eslint-plugin-eslint-plugin": "^2.0.1"
},
"dependencies": {
"@loopback/context": "^1.6.0",
Expand Down
5 changes: 4 additions & 1 deletion examples/rpc-server/package.json
Expand Up @@ -51,6 +51,9 @@
"@types/node": "^10.11.2",
"@types/p-event": "^1.3.0",
"eslint": "^5.14.1",
"typescript": "^3.3.1"
"typescript": "^3.3.1",
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.4.2",
"eslint-plugin-eslint-plugin": "^2.0.1"
}
}
5 changes: 4 additions & 1 deletion examples/soap-calculator/package.json
Expand Up @@ -60,6 +60,9 @@
"mocha": "^6.0.0",
"source-map-support": "^0.5.5",
"eslint": "^5.14.1",
"typescript": "^3.3.1"
"typescript": "^3.3.1",
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.4.2",
"eslint-plugin-eslint-plugin": "^2.0.1"
}
}
5 changes: 4 additions & 1 deletion examples/todo-list/package.json
Expand Up @@ -56,7 +56,10 @@
"@types/node": "^10.11.2",
"lodash": "^4.17.10",
"eslint": "^5.14.1",
"typescript": "^3.3.1"
"typescript": "^3.3.1",
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.4.2",
"eslint-plugin-eslint-plugin": "^2.0.1"
},
"keywords": [
"loopback",
Expand Down
5 changes: 4 additions & 1 deletion examples/todo/package.json
Expand Up @@ -56,7 +56,10 @@
"@types/node": "^10.11.2",
"lodash": "^4.17.10",
"eslint": "^5.14.1",
"typescript": "^3.3.1"
"typescript": "^3.3.1",
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.4.2",
"eslint-plugin-eslint-plugin": "^2.0.1"
},
"keywords": [
"loopback",
Expand Down
5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -20,7 +20,10 @@
"husky": "^1.3.1",
"lerna": "^3.13.0",
"typescript": "^3.3.1",
"eslint": "^5.14.1"
"@typescript-eslint/eslint-plugin": "^1.4.2",
"@typescript-eslint/parser": "^1.4.2",
"eslint": "^5.14.1",
"eslint-plugin-eslint-plugin": "^2.0.1"
},
"scripts": {
"postinstall": "lerna bootstrap && npm run -s update-greenkeeper-json",
Expand Down
21 changes: 19 additions & 2 deletions packages/eslint-config/.eslintrc.js
Expand Up @@ -3,6 +3,11 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

/**
* Default ESLint configuration for LoopBack
*
* See https://eslint.org/docs/user-guide/configuring
*/
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
Expand All @@ -24,7 +29,7 @@ module.exports = {
// TypeScript allows the same name for namespace and function
'no-redeclare': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
Expand All @@ -35,14 +40,26 @@ module.exports = {
'@typescript-eslint/no-angle-bracket-type-assertion': 'off',
'@typescript-eslint/prefer-interface': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-unused-vars': 'off',

// Disable the base `no-unused-vars` to use `typescript`
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
// Turn it off for now before we find out how it applies to decorators
'off',
{
vars: 'all',
args: 'none',
ignoreRestSiblings: false,
},
],
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/no-triple-slash-reference': 'off',
'@typescript-eslint/no-empty-interface': 'off',
},
parserOptions: {
sourceType: 'module',
ecmaFeatures: {
ecmaVersion: 2017,
jsx: false,
},
},
Expand Down

0 comments on commit d0e6556

Please sign in to comment.