Skip to content
This repository was archived by the owner on Mar 29, 2020. It is now read-only.

Commit 27089e5

Browse files
committed
feat: split off packages for react/typescript and convert to monorepo
BREAKING CHANGE: react, react-native, and typescript configs are no longer included in the eslint-config-anvilabs package
1 parent ccfb364 commit 27089e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6135
-934
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
!.eslintrc.js
1+
node_modules
2+
!.eslintrc.js

.eslintrc.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
const baseConfig = require('./');
2-
31
module.exports = {
4-
extends: './index.js',
5-
rules: {
6-
'prettier/prettier': [
7-
'error',
8-
Object.assign({}, baseConfig.rules['prettier/prettier'][1], {
9-
trailingComma: 'es5',
10-
}),
11-
],
12-
},
2+
extends: ['anvilabs', 'anvilabs/es5'],
133
};

.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
# node.js
66
#
7-
node_modules/
8-
npm-debug.log
9-
yarn-error.log
7+
/node_modules/
8+
/*.log
9+
/packages/*/node_modules/
10+
/packages/*/*.log
1011

1112
# ESLint
1213
#
13-
.eslintcache
14+
/.eslintcache

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ notifications:
1414
on_pull_requests: false
1515
secure: NNoU8uh0rzaSnStMrI6+aQtcZTtwpJ3DTmu6mdGrRZviLqTOeBcpgVTPWjueuHJ3XJujCQOtZzF/4MrA51xRDQHF68Tfnue7SsQS1ksLLJSy/jPCCc7fiqZcSGYNwCvSEd1sgAYIbFGiKArEmzmCUmcUCWlIBz+UfCbIDCKBxx4skBHdVjVJ5Ju/EtJVWof2S84EcvLRG3HtUCapWvS+o9znjO0RYY1Sa1Qe7JUoMsS3QIV69eZ6abGS+N80i3EJ/gasfeMTPXPnm3OiVcaiABlHyezyrizTSIkE77/qXTwJUjLpVbHNm5gahcouTwlNS/wV6chX+iRirkeHj5lzTTGHD7UdXwv+VgvYKp83D0EwxUYXG/7iKTUijVddMW2xtE53Nk/+DS1zYXCwhKubRO+Fg5yKuhXOR8xGXqd+rJ0RXxDxu9VNTZhfSWVMFyvKEma4dzgUBjuPUUDq4dsu6IsrAMQ+InAdwcqutKJdaXFl2iRyvEmKDLBd9SjisWyxGBBk4kIN6tx5+eRXLf9pVBnXV105HquMa7uY6t/qUVwKTNEc6hCRPMRBR+JLAvdHqlZecFHja28KH1V5OaZH/phuqqILxYzeIyahvWN8UnLH9dBt/vJZQmyoyJTg1/PoFqFOYSGUSodi49LDODXuSq1lJP4zLJxpwrKbJ1AKYjo=
1616
script:
17-
- npm run test
17+
- yarn test
1818
after_success:
19-
- npm run semantic-release
19+
- yarn run semantic-release

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Anvilabs, LLC <info@anvilabs.co> (http://anvilabs.co)
3+
Copyright (c) 2016 Anvilabs, LLC <info@anvilabs.co> (https://anvilabs.co)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,9 @@
11
# eslint-config-anvilabs
22

33
[![Build Status](https://img.shields.io/travis/anvilabs/eslint-config-anvilabs.svg)](https://travis-ci.org/anvilabs/eslint-config-anvilabs)
4-
[![Version](https://img.shields.io/npm/v/eslint-config-anvilabs.svg)](http://npm.im/eslint-config-anvilabs)
5-
[![Dependency Status](https://img.shields.io/david/anvilabs/eslint-config-anvilabs.svg)](https://david-dm.org/anvilabs/eslint-config-anvilabs)
6-
[![devDependency Status](https://img.shields.io/david/dev/anvilabs/eslint-config-anvilabs.svg)](https://david-dm.org/anvilabs/eslint-config-anvilabs?type=dev)
74
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
85

9-
Anvilabs' ESLint config, following our internal styleguide. Makes use of [prettier](https://github.com/jlongster/prettier) for formatting.
10-
11-
## Usage
12-
13-
This config relies dangerously on npm@3/yarn flatter tree for its dependencies (because of eslint/issues/3458), so installation may be as simple as:
14-
15-
```bash
16-
$ yarn add eslint prettier eslint-config-anvilabs --dev
17-
# or
18-
$ npm install eslint prettier eslint-config-anvilabs --save-dev
19-
```
20-
21-
Then add the extends to your `.eslintrc.js`:
22-
23-
```js
24-
module.exports = {
25-
extends: 'anvilabs',
26-
rules: {
27-
// your overrides
28-
},
29-
};
30-
```
31-
32-
### Other configs
33-
34-
This config also exposes a few other configs that we use often and pull in as needed.
35-
36-
You can use them standalone:
37-
38-
```js
39-
module.exports = {
40-
extends: 'anvilabs/<config-name>',
41-
};
42-
```
43-
44-
Or in combination with the base config (recommended):
45-
46-
```js
47-
module.exports = {
48-
extends: ['anvilabs', 'anvilabs/<config-name>'],
49-
};
50-
```
51-
52-
You can also use [ESLint@4 overrides](http://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns) to apply a config only to certain files. For example:
53-
54-
```js
55-
module.exports = {
56-
...
57-
overrides: [
58-
Object.assign(
59-
{
60-
files: ['**/__tests__/*-test.js', '**/__mocks__/*.js'],
61-
},
62-
require('eslint-config-anvilabs/jest')
63-
),
64-
],
65-
};
66-
67-
Available configs include:
68-
69-
- `'anvilabs/babel'` for usage with [babel transformations](https://github.com/babel/babel-eslint)
70-
- `'anvilabs/flowtype'` for [Flow](https://flowtype.org/) related rules
71-
- `'anvilabs/jest'` for [Jest](https://facebook.github.io/jest/) related rules
72-
- `'anvilabs/lodash'` for [Lodash](https://lodash.com/) related rules
73-
- `'anvilabs/react'` for [React](https://facebook.github.io/react/) related rules
74-
- `'anvilabs/react-native'` for [React Native](https://facebook.github.io/react-native/) related rules
75-
76-
### Things to know
77-
78-
- Running ESLint will report an error if your code does not match prettier style. The rule is autofixable – if you run ESLint with the `--fix` flag, your code will be formatted according to prettier style.
79-
80-
## Credits
81-
82-
Inspired by [Kent C. Dodds' ESLint config](https://github.com/kentcdodds/eslint-config-kentcdodds).
6+
Anvilabs' ESLint configs, following our internal styleguide. See individual packages in [packages](./packages/).
837

848
## License
859

commitlint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-angular'],
3+
rules: {
4+
'scope-case': [0],
5+
},
6+
};

lerna.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"lerna": "2.2.0",
3+
"version": "0.0.0",
4+
"npmClient": "yarn"
5+
}

package.json

Lines changed: 24 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,54 @@
11
{
22
"name": "eslint-config-anvilabs",
3-
"version": "0.0.0-development",
4-
"description": "Anvilabs' ESLint config, following our internal styleguide",
5-
"keywords": ["eslint", "eslint config", "config", "anvilabs", "styleguide"],
6-
"repository": "anvilabs/eslint-config-anvilabs",
7-
"homepage": "https://github.com/anvilabs/eslint-config-anvilabs#readme",
8-
"bugs": {
9-
"url": "https://github.com/anvilabs/eslint-config-anvilabs/issues"
10-
},
3+
"private": true,
114
"license": "MIT",
12-
"author": {
13-
"name": "Ayan Yenbekbay",
14-
"email": "ayan.yenb@gmail.com",
15-
"url": "http://yenbekbay.me"
16-
},
175
"engines": {
186
"node": ">=6.0.0"
197
},
20-
"main": "index.js",
21-
"files": [
22-
"rules/*.js",
23-
"babel.js",
24-
"flowtype.js",
25-
"index.js",
26-
"jest.js",
27-
"lodash.js",
28-
"react-base.js",
29-
"react-native.js",
30-
"react.js",
31-
"typescript.js"
32-
],
338
"scripts": {
34-
"lint": "eslint .",
9+
"preinstall": "yarn run clean-yarn-cache",
10+
"postinstall": "lerna bootstrap",
11+
"clean-install":
12+
"lerna clean; rm -rf node_modules; yarn run clean-yarn-cache",
13+
"clean-yarn-cache": "rm -rf $(yarn cache dir)/*eslint-config-anvilabs*",
14+
"lint": "eslint --cache .",
3515
"lint:fix": "eslint --cache --fix .",
36-
"find-new-rules:babel":
37-
"eslint-find-rules --unused ./test/fixtures/babel.js",
38-
"find-new-rules:base": "eslint-find-rules --unused ./index.js",
39-
"find-new-rules:flowtype":
40-
"eslint-find-rules --unused ./test/fixtures/flowtype.js",
41-
"find-new-rules:jest": "eslint-find-rules --unused ./test/fixtures/jest.js",
42-
"find-new-rules:lodash":
43-
"eslint-find-rules --unused ./test/fixtures/lodash.js",
44-
"find-new-rules:react-native":
45-
"eslint-find-rules --unused ./test/fixtures/react-native.js",
46-
"find-new-rules:react":
47-
"eslint-find-rules --unused ./test/fixtures/react.js",
48-
"find-new-rules:typescript":
49-
"eslint-find-rules --unused ./test/fixtures/typescript.js",
50-
"find-new-rules": "run-p --silent find-new-rules:*",
16+
"find-new-rules": "lerna run find-new-rules -- --silent",
5117
"prettier-check":
52-
"eslint --print-config index.js | eslint-config-prettier-check",
18+
"eslint --print-config packages/eslint-config-anvilabs/index.js | eslint-config-prettier-check",
5319
"jest": "jest",
5420
"test": "run-p --silent lint find-new-rules prettier-check jest",
5521
"precommit": "lint-staged",
56-
"commitmsg": "validate-commit-msg",
22+
"commitmsg": "commitlint -e",
5723
"prepush": "yarn test",
5824
"semantic-release":
59-
"semantic-release pre && npm publish && semantic-release post"
25+
"semantic-release pre && node scripts/publish.js && semantic-release post",
26+
"outdated":
27+
"for P in $(ls packages); do echo '\\n' === $P ===; cd \"packages/$P/\"; yarn outdated; cd ../..; done"
6028
},
6129
"lint-staged": {
62-
"{*.js,{rules,test}/**/*.js}": ["eslint --cache --fix", "git add"],
63-
"{*.json,.vscode/*.json}": ["prettier --write", "git add"]
30+
"{*.js,scripts/*.js,packages/*/{*.js,{rules,test}/*.js}": [
31+
"eslint --cache --fix",
32+
"git add"
33+
],
34+
"{*.json,.vscode/*.json,packages/*/*.json}": ["prettier --write", "git add"]
6435
},
6536
"jest": {
66-
"roots": ["<rootDir>/rules"],
37+
"roots": ["<rootDir>/packages/eslint-config-anvilabs/rules/"],
6738
"testEnvironment": "node",
6839
"testRegex": "/__tests__/.+-test\\.js$"
6940
},
70-
"config": {
71-
"validate-commit-msg": {
72-
"maxSubjectLength": 72,
73-
"types": "conventional-commit-types"
74-
}
75-
},
76-
"peerDependencies": {
77-
"eslint": "^4.6.0",
78-
"prettier": "^1.6.0"
79-
},
80-
"dependencies": {
81-
"babel-eslint": "^7.2.3",
82-
"eslint-config-airbnb-base": "^12.0.0",
83-
"eslint-config-prettier": "^2.4.0",
84-
"eslint-plugin-babel": "^4.1.2",
85-
"eslint-plugin-eslint-comments": "^1.0.3",
86-
"eslint-plugin-flowtype": "^2.35.1",
87-
"eslint-plugin-import": "^2.7.0",
88-
"eslint-plugin-jest": "^21.0.0",
89-
"eslint-plugin-jsx-a11y": "^6.0.2",
90-
"eslint-plugin-lodash-fp": "^2.1.3",
91-
"eslint-plugin-no-use-extend-native": "^0.3.12",
92-
"eslint-plugin-prettier": "^2.2.0",
93-
"eslint-plugin-promise": "^3.5.0",
94-
"eslint-plugin-react": "^7.3.0",
95-
"eslint-plugin-react-native": "^3.1.0",
96-
"eslint-plugin-typescript": "^0.7.0",
97-
"eslint-plugin-unicorn": "^2.1.1",
98-
"typescript-eslint-parser": "^8.0.0"
99-
},
10041
"devDependencies": {
42+
"@commitlint/cli": "^3.2.0",
43+
"@commitlint/config-angular": "^3.1.1",
10144
"eslint": "^4.6.1",
102-
"eslint-find-rules": "^3.1.1",
45+
"eslint-config-anvilabs": "file:./packages/eslint-config-anvilabs",
10346
"husky": "^0.14.3",
10447
"jest": "^21.0.1",
48+
"lerna": "^2.2.0",
10549
"lint-staged": "^4.1.1",
10650
"npm-run-all": "^4.1.1",
10751
"prettier": "^1.6.1",
108-
"semantic-release": "^7.0.2",
109-
"validate-commit-msg": "^2.14.0"
52+
"semantic-release": "^7.0.2"
11053
}
11154
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/test/
2+
/*.log

0 commit comments

Comments
 (0)