Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

v3 - organize imports with eslint #657

Merged
merged 5 commits into from
Sep 17, 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
71 changes: 71 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
},
extends: [
"eslint:recommended",
"plugin:storybook/recommended",
"plugin:@typescript-eslint/recommended",
// "plugin:@typescript-eslint/recommended-type-checked", // TODO
// "plugin:@typescript-eslint/stylistic-type-checked", // TODO
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended",
"next/core-web-vitals",
],
plugins: [
"@typescript-eslint",
"unused-imports",
"no-relative-import-paths",
"import",
"prettier",
],
ignorePatterns: ["dist", "node_modules", ".sanity"],
settings: {
"import/resolver": {
typescript: {
project: "./tsconfig.json",
},
},
},
rules: {
"@typescript-eslint/no-explicit-any": "off", // TODO
"unused-imports/no-unused-imports": "error",
"import/no-named-as-default": "off",
"import/no-unresolved": "error",
"no-relative-import-paths/no-relative-import-paths": [
"warn",
{ allowSameFolder: true },
],
"import/order": [
"error",
{
groups: [
"builtin", // from NodeJS native
"external",
"internal",
["sibling", "parent"], // sibling and parent types they can be mingled together
"index",
"unknown",
],
"newlines-between": "always",
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
"sort-imports": [
"error",
{
ignoreCase: false,
ignoreDeclarationSort: true, // handled by eslint-plugin-import
ignoreMemberSort: false,
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
allowSeparatedGroups: true,
},
],
},
};
9 changes: 0 additions & 9 deletions .eslintrc.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Prettier Check
name: Code Quality Checks

on:
pull_request:
branches: [main, v3]

jobs:
prettier:
code_quality:
runs-on: ubuntu-latest

steps:
Expand All @@ -16,9 +16,15 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/workflows/prettier.yml') }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/workflows/code-quality.yml') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci
mathiazom marked this conversation as resolved.
Show resolved Hide resolved

- name: Prettier Check
run: npx prettier --check .

- name: ESLint Check
run: npx eslint .
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ To get started with Sankitty, follow these steps:
- `npm run start`: Start the Next.js application in production mode.
- `npm run format`: Format the codebase using Prettier to ensure consistent code style across the project.
- `npm run lint`: Lint the project using ESLint.
- `npm run fix`: Format and lint in one command.

## Project Structure

Expand Down
Loading