Skip to content

Commit

Permalink
feat(build): add eslint scripts and default configs
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed May 28, 2019
1 parent c949e85 commit fbeb150
Show file tree
Hide file tree
Showing 13 changed files with 437 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ packages/http-server/* @hacksparrow @bajtos
packages/cli/* @raymondfeng @bajtos
packages/context/* @bajtos @raymondfeng
packages/core/* @bajtos @raymondfeng
packages/eslint-config/* @raymondfeng
packages/metadata/* @raymondfeng
packages/openapi-spec-builder/* @bajtos @raymondfeng
packages/openapi-v3/* @bajtos @jannyHou
Expand Down
1 change: 1 addition & 0 deletions docs/site/MONOREPO.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The [loopback-next](https://github.com/strongloop/loopback-next) repository uses
| [context](https://github.com/strongloop/loopback-next/tree/master/packages/context) | @loopback/context | Facilities to manage artifacts and their dependencies in your Node.js applications. The module exposes TypeScript/JavaScript APIs and decorators to register artifacts, declare dependencies, and resolve artifacts by keys. It also serves as an IoC container to support dependency injection. |
| [core](https://github.com/strongloop/loopback-next/tree/master/packages/core) | @loopback/core | Define and implement core constructs such as Application and Component |
| [docs](https://github.com/strongloop/loopback-next/tree/master/docs) | @loopback/docs | Documentation files rendered at [https://loopback.io](https://loopback.io) |
| [eslint-config](https://github.com/strongloop/loopback-next/tree/master/packages/eslint-config) | @loopback/eslint-config | ESLint configuration for LoopBack projects |
| [example-express-composition](https://github.com/strongloop/loopback-next/tree/master/examples/express-composition) | @loopback/example-express-composition | A simple Express application that uses LoopBack 4 REST API |
| [example-greeter-extension](https://github.com/strongloop/loopback-next/tree/master/examples/greeter-extension) | @loopback/example-greeter-extension | An example showing how to implement the extension point/extension pattern using LoopBack 4 |
| [example-hello-world](https://github.com/strongloop/loopback-next/tree/master/examples/hello-world) | @loopback/example-hello-world | A simple hello-world application using LoopBack 4 |
Expand Down
1 change: 1 addition & 0 deletions greenkeeper.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"packages/cli/package.json",
"packages/context/package.json",
"packages/core/package.json",
"packages/eslint-config/package.json",
"packages/http-caching-proxy/package.json",
"packages/http-server/package.json",
"packages/metadata/package.json",
Expand Down
49 changes: 49 additions & 0 deletions packages/build/bin/run-eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env node
// Copyright IBM Corp. 2017,2018. All Rights Reserved.
// Node module: @loopback/build
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

/*
========
Usage:
node ./bin/run-eslint
========
*/

'use strict';

function run(argv, options) {
const utils = require('./utils');

const eslintOpts = argv.slice(2);

const isConfigSet = utils.isOptionSet(eslintOpts, '-c', '--config');
const isExtSet = utils.isOptionSet(eslintOpts, '--ext');

const eslintConfigFile = isConfigSet
? null
: utils.getConfigFile('.eslintrc.js', '.eslintrc.json');

const eslintIgnoreFile = utils.getConfigFile('.eslintignore');

const args = [];
if (eslintConfigFile) {
args.push('-c', eslintConfigFile);
}
if (eslintIgnoreFile) {
args.push('--ignore-path', eslintIgnoreFile);
}

if (!isExtSet) {
args.push('--ext', '.js,.ts');
}
args.push(...eslintOpts);

return utils.runCLI('eslint/bin/eslint', args, options);
}

module.exports = run;
if (require.main === module) run(process.argv);
4 changes: 4 additions & 0 deletions packages/build/config/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
coverage/
api-docs/
3 changes: 3 additions & 0 deletions packages/build/config/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: '@loopback/eslint-config',
};
201 changes: 201 additions & 0 deletions packages/build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fbeb150

Please sign in to comment.