Skip to content

Commit d78942d

Browse files
authored
feat: add full codely config (#10)
* feat: add full codely config * feat: add full codely config
1 parent 9e8fedc commit d78942d

8 files changed

Lines changed: 102 additions & 32 deletions

File tree

README.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,6 @@ export default [
4747
]
4848
```
4949

50-
For TypeScript:
51-
```js
52-
import eslintConfigCodely from "eslint-config-codely";
53-
54-
export default [
55-
...eslintConfigCodely.ts,
56-
{
57-
// You should add the path to your tsconfig
58-
files: ["**/*.ts", "**/*.tsx"],
59-
languageOptions: {
60-
parserOptions: {
61-
project: ["./tsconfig.json"],
62-
},
63-
}
64-
// Your config here
65-
}
66-
]
67-
```
68-
6950
ℹ️ Please note that some of the rules enabled by default require that you have `strict: true` in your `tsconfig.json`.
7051

7152
## 🤔 What it does

configs/codely-full.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import eslintPluginCheckFile from "eslint-plugin-check-file";
2+
3+
import eslintPluginCodely from "./codely-ts.js";
4+
5+
export default [
6+
...eslintPluginCodely,
7+
{
8+
ignores: [
9+
"**/.idea/",
10+
"**/.next/",
11+
"**/.storybook/",
12+
"**/.turbo/",
13+
"**/.yarn/",
14+
"**/node_modules/",
15+
"**/storybook-static/",
16+
"**/test-results/",
17+
],
18+
},
19+
{
20+
plugins: {
21+
"check-file": eslintPluginCheckFile,
22+
},
23+
rules: {
24+
"prettier/prettier": ["error", { printWidth: 120, useTabs: true, tabWidth: 4 }],
25+
"check-file/folder-naming-convention": [
26+
"error",
27+
{
28+
// kebab-case and folders with square brackets are allowed
29+
"**/*": "+([a-z-\\[\\]])",
30+
},
31+
],
32+
"simple-import-sort/imports": [
33+
"error",
34+
{
35+
groups: [
36+
// Side effect imports: `import "./setup";`
37+
["^\\u0000"],
38+
// Packages: `import fs from "fs";`
39+
["^@?\\w"],
40+
// Internal packages.
41+
["^(@|@codely)(/.*|$)"],
42+
// Parent imports. Put `..` last.
43+
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
44+
// Other relative imports. Put same-folder imports and `.` last.
45+
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
46+
// Style imports.
47+
["^.+\\.s?css$"],
48+
],
49+
},
50+
],
51+
"no-use-before-define": [
52+
"error",
53+
{
54+
functions: false,
55+
classes: true,
56+
variables: true,
57+
allowNamedExports: false,
58+
},
59+
],
60+
},
61+
},
62+
];

configs/codely-js.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ export default [
7474
// style
7575
curly: "error",
7676
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
77-
"padding-line-between-statements": [
78-
"error",
79-
{ blankLine: "always", prev: "*", next: "return" },
80-
],
77+
"padding-line-between-statements": ["error", { blankLine: "always", prev: "*", next: "return" }],
8178

8279
// plugins
8380
"import/first": "error",

configs/codely-ts.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,10 @@ export default [
9696
"@typescript-eslint/explicit-module-boundary-types": ["error"],
9797
},
9898
},
99+
{
100+
files: ["**/*.js"],
101+
rules: {
102+
"@typescript-eslint/no-unused-vars": ["off"],
103+
},
104+
},
99105
];

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import eslintConfigCodely from "./index.js";
22

3-
export default [...eslintConfigCodely.js];
3+
export default [...eslintConfigCodely.full];

index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import jsConfigs from "./configs/codely-js.js";
2-
import tsConfigs from "./configs/codely-ts.js";
1+
import fullConfig from "./configs/codely-full.js";
2+
import jsConfig from "./configs/codely-js.js";
3+
import tsConfig from "./configs/codely-ts.js";
34

45
const eslintConfigCodely = {
5-
js: jsConfigs,
6-
ts: tsConfigs,
6+
js: jsConfig,
7+
ts: tsConfig,
8+
full: fullConfig,
79
};
810

911
export default eslintConfigCodely;

package-lock.json

Lines changed: 24 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-codely",
3-
"version": "4.0.1",
3+
"version": "4.1.0",
44
"description": "Codely's ESLint and Prettier Config",
55
"main": "index.js",
66
"scripts": {
@@ -16,6 +16,7 @@
1616
"@types/node": "^20.10.1",
1717
"eslint": "^9.9.1",
1818
"eslint-config-prettier": "^9.1.0",
19+
"eslint-plugin-check-file": "^2.8.0",
1920
"eslint-plugin-import-x": "^4.1.1",
2021
"eslint-plugin-prettier": "^5.2.1",
2122
"eslint-plugin-simple-import-sort": "^12.1.1",

0 commit comments

Comments
 (0)