Skip to content

Commit c896a7a

Browse files
committed
Add ESLint config
1 parent 34abd4f commit c896a7a

File tree

6 files changed

+2228
-0
lines changed

6 files changed

+2228
-0
lines changed

packages/eslint-config/.eslintrc.js

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
module.exports = {
2+
extends: [
3+
"prettier",
4+
"plugin:import/recommended",
5+
"plugin:import/typescript",
6+
],
7+
plugins: ["import"],
8+
rules: {
9+
"no-alert": "error",
10+
"no-await-in-loop": "error",
11+
"no-return-assign": "error",
12+
"no-restricted-syntax": [
13+
"error",
14+
"FunctionExpression",
15+
"LabeledStatement",
16+
"WithStatement",
17+
],
18+
"no-var": "error",
19+
"no-use-before-define": "error",
20+
"no-unused-expressions": ["error", { enforceForJSX: true }],
21+
"no-param-reassign": [
22+
"error",
23+
{
24+
props: false,
25+
},
26+
],
27+
"no-console": "error",
28+
"no-underscore-dangle": "error",
29+
30+
"prefer-const": [
31+
"error",
32+
{
33+
destructuring: "all",
34+
},
35+
],
36+
"arrow-body-style": [
37+
"error",
38+
"as-needed",
39+
{ requireReturnForObjectLiteral: false },
40+
],
41+
"space-before-function-paren": "off",
42+
"comma-dangle": [
43+
"error",
44+
{
45+
arrays: "only-multiline",
46+
objects: "only-multiline",
47+
imports: "only-multiline",
48+
exports: "only-multiline",
49+
functions: "never",
50+
},
51+
],
52+
53+
"import/first": "error",
54+
"import/newline-after-import": "error",
55+
"import/no-duplicates": "error",
56+
"import/no-unassigned-import": ["error", { allow: ["@/styles/*.css"] }],
57+
"import/no-unresolved": ["error", { ignore: ["@/styles/(.*).css"] }],
58+
"import/extensions": ["error", "never", { css: "always" }],
59+
"import/no-dynamic-require": "error",
60+
"import/no-cycle": "error",
61+
"import/order": [
62+
"error",
63+
{
64+
groups: [
65+
"builtin",
66+
"external",
67+
"internal",
68+
["parent", "sibling"],
69+
"type",
70+
],
71+
},
72+
],
73+
},
74+
};

packages/eslint-config/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# `@hkamran/prettier-config`
2+
3+
[![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL3.0-green.svg)](../../LICENSE.md)
4+
[![npm version](https://badge.fury.io/js/%40hkamran%2Fprettier-config.svg)](https://badge.fury.io/js/%40hkamran%2Fprettier-config.svg)
5+
6+
My personal Prettier configuration
7+
8+
## Installation
9+
10+
```bash
11+
npm i -D @hkamran/prettier-config
12+
```
13+
14+
## Usage
15+
16+
Add the following key-value pair to your `package.json` file.
17+
18+
```json
19+
"prettier": "@hkamran/prettier-config"
20+
```
21+
22+
## Settings
23+
24+
| Rule | Setting |
25+
| --------------- | ------- |
26+
| Trailing Commas | all |
27+
| Tab Width | 4 |

packages/eslint-config/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const eslintrc = require("./.eslintrc.js");
2+
3+
module.exports = eslintrc;

packages/eslint-config/package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "@hkamran/eslint-config",
3+
"version": "1.0.0",
4+
"license": "AGPL-3.0-or-later",
5+
"description": "My personal ESLint configuration",
6+
"main": "index.js",
7+
"author": {
8+
"name": "H. Kamran",
9+
"email": "[email protected]",
10+
"url": "https://hkamran.com"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/hkamran80/devtools.git",
15+
"directory": "packages/prettier-config"
16+
},
17+
"bugs": {
18+
"url": "https://github.com/hkamran80/devtools/issues"
19+
},
20+
"homepage": "https://github.com/hkamran80/devtools/blob/main/packages/prettier-config/README.md",
21+
"keywords": [
22+
"eslint",
23+
"eslint-config"
24+
],
25+
"devDependencies": {
26+
"@hkamran/prettier-config": "link:../prettier-config",
27+
"@typescript-eslint/parser": "^5.60.1",
28+
"eslint": "^8.43.0",
29+
"eslint-config-next": "^13.4.7",
30+
"eslint-config-prettier": "^8.8.0",
31+
"eslint-plugin-import": "npm:[email protected]",
32+
"prettier": "^2.8.8",
33+
"typescript": "^5.1.6"
34+
},
35+
"peerDependencies": {
36+
"eslint": "^8.0.0",
37+
"eslint-plugin-import": "npm:[email protected]",
38+
"prettier": "^2.7.1",
39+
"typescript": "^4.8.4"
40+
},
41+
"eslintConfig": {
42+
"extends": [
43+
"./.eslintrc.js"
44+
]
45+
},
46+
"prettier": "@hkamran/prettier-config"
47+
}

0 commit comments

Comments
 (0)