Skip to content

Commit afd9f69

Browse files
committed
Initial commit (forked from fewlinesco/eslint-config)
0 parents  commit afd9f69

19 files changed

+3420
-0
lines changed

.circleci/config.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
version: 2.1
2+
jobs:
3+
build-and-test:
4+
docker:
5+
- image: circleci/node:12.16.2
6+
steps:
7+
- checkout
8+
- restore_cache:
9+
keys:
10+
- yarn-cache-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
11+
- yarn-cache-{{ .Branch }}-
12+
- yarn-cache-
13+
- run:
14+
name: yarn-install
15+
command: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
16+
- run:
17+
name: tests
18+
command: yarn --cache-folder ~/.cache/yarn test
19+
- save_cache:
20+
paths:
21+
- ~/.cache/yarn
22+
key: yarn-cache-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
23+
24+
workflows:
25+
version: 2
26+
build-and-test:
27+
jobs:
28+
- build-and-test

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.lcov
2+
*.log
3+
*.pid
4+
*.pid.lock
5+
*.seed
6+
.cache
7+
.env
8+
.env.test
9+
.eslintcache
10+
.node_repl_history
11+
.npm
12+
.yarn-integrity
13+
coverage
14+
lerna-debug.log*
15+
logs
16+
node_modules/
17+
npm-debug.log*
18+
pids
19+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
20+
yarn-debug.log*
21+
yarn-error.log*

.tool-versions

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
yarn 1.22.5
2+
nodejs 18.9.1

.vscode/settings.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"[javascript]": {
3+
"editor.formatOnSave": true,
4+
"editor.defaultFormatter": "esbenp.prettier-vscode"
5+
},
6+
"[javascriptreact]": {
7+
"editor.formatOnSave": true,
8+
"editor.defaultFormatter": "esbenp.prettier-vscode"
9+
},
10+
"[typescript]": {
11+
"editor.formatOnSave": true,
12+
"editor.defaultFormatter": "esbenp.prettier-vscode"
13+
},
14+
"[typescriptreact]": {
15+
"editor.formatOnSave": true,
16+
"editor.defaultFormatter": "esbenp.prettier-vscode"
17+
},
18+
"[graphql]": {
19+
"editor.formatOnSave": true,
20+
"editor.defaultFormatter": "esbenp.prettier-vscode"
21+
},
22+
"[json]": {
23+
"editor.formatOnSave": true,
24+
"editor.defaultFormatter": "esbenp.prettier-vscode"
25+
},
26+
"[jsonc]": {
27+
"editor.formatOnSave": true,
28+
"editor.defaultFormatter": "esbenp.prettier-vscode"
29+
},
30+
"[css]": {
31+
"editor.defaultFormatter": "esbenp.prettier-vscode"
32+
},
33+
"[xml]": {
34+
"editor.defaultFormatter": "esbenp.prettier-vscode"
35+
},
36+
"[prisma]": {
37+
"editor.formatOnSave": true,
38+
"editor.defaultFormatter": "Prisma.prisma"
39+
},
40+
"[markdown]": {
41+
"editor.defaultFormatter": "esbenp.prettier-vscode"
42+
},
43+
"editor.formatOnSave": true
44+
}

CHANGELOG.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# CHANGELOG
2+
3+
## 3.1.2 - 2021-02-23
4+
5+
Bug fix: `react-typescript.js` configuration updated (missed in the previous fix)
6+
7+
## 3.1.1 - 2021-02-22
8+
9+
### Bump of dependencies
10+
11+
```ts
12+
eslint-config-prettier 7.2.08.0.0 dev
13+
@typescript-eslint/eslint-plugin 4.14.04.15.1 dev
14+
@typescript-eslint/parser 4.14.04.15.1 dev
15+
eslint 7.18.07.20.0 dev
16+
typescript 4.1.34.1.5 dev
17+
```
18+
19+
## 3.1.0 - 2021-01-29
20+
21+
- Added import path group rule. `@src/**` is now considered an internal import.
22+
23+
### Bump of dependencies
24+
25+
```ts
26+
@typescript-eslint/eslint-plugin dev ~1mo 4.11.04.14.0 ~4d
27+
@typescript-eslint/parser dev ~1mo 4.11.04.14.0 ~4d
28+
eslint dev ~1mo 7.16.07.18.0 ~6d
29+
eslint-config-prettier dev ~1mo 7.1.07.2.0 ~4d
30+
eslint-plugin-prettier dev ~1mo 3.3.03.3.1 ~18d
31+
32+
4 minor, 1 patch updates
33+
```
34+
35+
## 3.0.0 - 2020-07-16
36+
37+
- Made `typescript.ts` extend `node.ts` configuration.
38+
39+
## 2.1.1 - 2020-07-06
40+
41+
- Added `es6:true` to `env` to allow usage of Node globals in the `node` preset.
42+
43+
## 2.1.0 - 2020-06-23
44+
45+
- Added `react-typescript` preset (which remove `prop-types` calls).
46+
47+
## 2.0.0 - 2020-04-28
48+
49+
- Added `eslint-plugin-import` which should be added as a dependency when upgrading.
50+
- Added the option `allowExpressions` in `@typescript-eslint/no-unused-vars` to avoid typing all callbacks.
51+
52+
## 1.1.0 - 2020-02-21
53+
54+
- Added `preact-typescript` preset.

CODE_OF_CONDUCT.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Contributing
2+
3+
We welcome Pull Requests from anyone 👐
4+
5+
By participating in this project, you agree to abide by its [Code of Conduct](CODE_OF_CONDUCT.md).
6+
7+
Before submitting a Pull Request, please ensure the following:
8+
9+
1. Your code is covered by tests
10+
2. Make sure all tests are passing
11+
3. Only have one commit with a relevant message (you can rebase and squash all your commits into a single one)
12+
4. Check that you're up to date by rebasing your branch with our `master` branch
13+
14+
## Setup
15+
16+
```sh-session
17+
$ git clone https://github.com/fewlinesco/eslint-config.git
18+
$ yarn install
19+
$ yarn test
20+
```

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License
2+
3+
Copyright (c) 2019 Fewlines, SAS. http://www.fewlines.co
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+

README.md

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Fewlines Javascript Styleguide
2+
3+
Disclaimer: this package is made for our internal usage and is only open source for convenience so
4+
we might not consider Pull Requests or Issues. Feel free to fork though.
5+
6+
This package includes the different styles we apply to our JavaScript and TypeScript code.
7+
8+
⚠️ As this plugin wants to use a minimalist configuration, it relies on using prettier via ESLint
9+
which means you could have to configure your editor. The goal is to not have the editor run prettier
10+
directly as it would conflict with ESLint.
11+
12+
## General rules
13+
14+
To enforce consistency throughout our imports and exports, we are using
15+
https://www.npmjs.com/package/eslint-plugin-import[eslint-plugin-import].
16+
17+
### Import
18+
19+
The set of rules we chose to organize our imports are the following groups:
20+
21+
- Built in and externals
22+
- Parents, siblings, indexes and path aliases
23+
24+
```js
25+
import { IncomingMessage, ServerResponse } from "http";
26+
import React from "react";
27+
28+
import { CustomError } from "@src/errors";
29+
import { Handler } from "./handler";
30+
```
31+
32+
## Usage
33+
34+
This plugin offer several configurations depending on your project type.
35+
36+
```shell
37+
yarn add -DE @fewlines/javascript-styleguide
38+
```
39+
40+
Add these lines to your package.json:
41+
42+
```json
43+
"eslintConfig": {
44+
"extends": [
45+
"./node_modules/@fewlines/javascript-styleguide/node"
46+
]
47+
},
48+
"prettier": "@fewlines/javascript-styleguide/prettier"
49+
```
50+
51+
### TypeScript project
52+
53+
Then add these lines to your package.json:
54+
55+
```json
56+
"eslintConfig": {
57+
"extends": "./node_modules/@fewlines/javascript-styleguide/typescript"
58+
}
59+
```
60+
61+
The TypeScript plugin extends the previous Node plugin so it is not needed.
62+
63+
### React project
64+
65+
Then add these lines to your package.json:
66+
67+
```json
68+
"eslintConfig": {
69+
"extends": "./node_modules/@fewlines/javascript-styleguide/react"
70+
}
71+
```
72+
73+
The React plugin extends the previous Node plugin so it is not needed.
74+
75+
### React + TypeScript project
76+
77+
⚠️ This preset only aim to remove the `prop-types` checks. You should use it along the `react` and
78+
`typescript` presets.
79+
80+
Then add these lines to your `package.json`:
81+
82+
```json
83+
"eslintConfig": {
84+
"extends": [
85+
"./node_modules/@fewlines/javascript-styleguide/react-typescript"
86+
]
87+
}
88+
```
89+
90+
The React + Typescript plugin extends the previous Node and TypeScript plugins.
91+
92+
### Remix project
93+
94+
```json
95+
"eslintConfig": {
96+
"extends": [
97+
"./node_modules/@fewlines/javascript-styleguide/remix"
98+
]
99+
}
100+
```
101+
102+
This version extends the React+TypeScript plugins.
103+
104+
## Contributing
105+
106+
See [CONTRIBUTING.md](CONTRIBUTING.md).

index.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
extends: ["eslint:recommended"],
3+
rules: {
4+
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
5+
},
6+
};

node.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
env: {
3+
node: true,
4+
es6: true,
5+
},
6+
parserOptions: {
7+
ecmaVersion: 2020,
8+
},
9+
plugins: ["import", "tailwindcss"],
10+
extends: ["./index", "plugin:tailwindcss/recommended"],
11+
rules: {
12+
"import/order": [
13+
"error",
14+
{
15+
alphabetize: {
16+
order: "asc",
17+
caseInsensitive: false,
18+
},
19+
"newlines-between": "always",
20+
pathGroups: [
21+
{
22+
pattern: "~*/*",
23+
group: "internal",
24+
},
25+
],
26+
groups: [
27+
["builtin", "external"],
28+
["internal", "parent", "sibling", "index"],
29+
],
30+
},
31+
],
32+
},
33+
};

0 commit comments

Comments
 (0)