Skip to content

Commit d0b4113

Browse files
Set up an ESLint configuration package that is used by an example app (#1)
* feat: run lerna init * feat(package): create a package to store eslint config * feat(app): create an example app * feat(app): add a script to run the example app * feat(app): make example app import data from package * feat(app): add eslint to example app and make it depends on package config * doc: update the readme * refactor: rename package name * refactor: rename directory * fix(app): set example app as private
1 parent f5c7103 commit d0b4113

10 files changed

Lines changed: 4888 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
# react-native-project-config
2-
Monorepo with packages for setting up ESLint, Typescript, Prettier and Jest
2+
Monorepo with packages for setting up ESLint, Typescript, Prettier and Jest.
3+
4+
## Presentation
5+
6+
The goal of the project is too have a set of configuration files that can be easily imported into a new project, which would reduce the burden of starting new projects.
7+
8+
This repo uses [lerna](https://lerna.js.org/) to maintain, version and publish various packages for configuring ESLint, Typescript, Prettier and Jest.
9+
10+
There is also an example app under `packages/example-app` whose goal is to demonstrate how to import and use the configuration packages.
11+
12+
## Commands
13+
14+
- `yarn lerna run start`: run the 'start' script in all packages (currently only present in `example-app`),
15+
- `yarn lerna run lint`: run the 'lint' script in all packages (currently only present in `example-app`).

lerna.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3+
"useWorkspaces": true,
4+
"version": "0.0.0"
5+
}

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "root",
3+
"private": true,
4+
"workspaces": [
5+
"packages/*"
6+
],
7+
"devDependencies": {
8+
"lerna": "^6.3.0"
9+
}
10+
}

packages/eslint/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use strict";
2+
3+
module.exports = {
4+
rules: {
5+
"no-console": "error",
6+
},
7+
};

packages/eslint/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "@bam.tech/eslint-config",
3+
"version": "0.0.0",
4+
"main": "index.js",
5+
"license": "MIT"
6+
}

packages/example-app/.eslintrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"env": {
3+
"es6": true
4+
},
5+
"extends": "@bam.tech/eslint-config",
6+
"parserOptions": {
7+
"ecmaVersion": "latest"
8+
}
9+
}

packages/example-app/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
'use strict';
2+
3+
console.log("This is a console.log statement to see it the linter produces an error");

packages/example-app/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "example-app",
3+
"version": "0.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"scripts": {
7+
"start": "node .",
8+
"lint": "eslint ."
9+
},
10+
"devDependencies": {
11+
"@bam.tech/eslint-config": "*",
12+
"eslint": "^8.31.0"
13+
},
14+
"private": "true"
15+
}

0 commit comments

Comments
 (0)