Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add full codely config #10

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,6 @@ export default [
]
```

For TypeScript:
```js
import eslintConfigCodely from "eslint-config-codely";

export default [
...eslintConfigCodely.ts,
{
// You should add the path to your tsconfig
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parserOptions: {
project: ["./tsconfig.json"],
},
}
// Your config here
}
]
```

ℹ️ Please note that some of the rules enabled by default require that you have `strict: true` in your `tsconfig.json`.

## 🤔 What it does
Expand Down
62 changes: 62 additions & 0 deletions configs/codely-full.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import eslintPluginCheckFile from "eslint-plugin-check-file";

import eslintPluginCodely from "./codely-ts.js";

export default [
...eslintPluginCodely,
{
ignores: [
"**/.idea/",
"**/.next/",
"**/.storybook/",
"**/.turbo/",
"**/.yarn/",
"**/node_modules/",
"**/storybook-static/",
"**/test-results/",
],
},
{
plugins: {
"check-file": eslintPluginCheckFile,
},
rules: {
"prettier/prettier": ["error", { printWidth: 120, useTabs: true, tabWidth: 4 }],
"check-file/folder-naming-convention": [
"error",
{
// kebab-case and folders with square brackets are allowed
"**/*": "+([a-z-\\[\\]])",
},
],
"simple-import-sort/imports": [
"error",
{
groups: [
// Side effect imports: `import "./setup";`
["^\\u0000"],
// Packages: `import fs from "fs";`
["^@?\\w"],
// Internal packages.
["^(@|@codely)(/.*|$)"],
// Parent imports. Put `..` last.
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
// Other relative imports. Put same-folder imports and `.` last.
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
// Style imports.
["^.+\\.s?css$"],
],
},
],
"no-use-before-define": [
"error",
{
functions: false,
classes: true,
variables: true,
allowNamedExports: false,
},
],
},
},
];
5 changes: 1 addition & 4 deletions configs/codely-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,7 @@ export default [
// style
curly: "error",
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
"padding-line-between-statements": [
"error",
{ blankLine: "always", prev: "*", next: "return" },
],
"padding-line-between-statements": ["error", { blankLine: "always", prev: "*", next: "return" }],

// plugins
"import/first": "error",
Expand Down
6 changes: 6 additions & 0 deletions configs/codely-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,10 @@ export default [
"@typescript-eslint/explicit-module-boundary-types": ["error"],
},
},
{
files: ["**/*.js"],
rules: {
"@typescript-eslint/no-unused-vars": ["off"],
},
},
];
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import eslintConfigCodely from "./index.js";

export default [...eslintConfigCodely.js];
export default [...eslintConfigCodely.full];
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import jsConfigs from "./configs/codely-js.js";
import tsConfigs from "./configs/codely-ts.js";
import fullConfig from "./configs/codely-full.js";
import jsConfig from "./configs/codely-js.js";
import tsConfig from "./configs/codely-ts.js";

const eslintConfigCodely = {
js: jsConfigs,
ts: tsConfigs,
js: jsConfig,
ts: tsConfig,
full: fullConfig,
};

export default eslintConfigCodely;
27 changes: 24 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-codely",
"version": "4.0.1",
"version": "4.1.0",
"description": "Codely's ESLint and Prettier Config",
"main": "index.js",
"scripts": {
Expand All @@ -16,6 +16,7 @@
"@types/node": "^20.10.1",
"eslint": "^9.9.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-check-file": "^2.8.0",
"eslint-plugin-import-x": "^4.1.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-simple-import-sort": "^12.1.1",
Expand Down