Skip to content

Commit

Permalink
Merge pull request #7 from GDSC-Hongik/feature/eslint-setting
Browse files Browse the repository at this point in the history
[Feature] eslint 초기 구성
  • Loading branch information
eugene028 authored May 14, 2024
2 parents 06d56c6 + c1ab5f3 commit 37bca64
Show file tree
Hide file tree
Showing 14 changed files with 3,045 additions and 1,236 deletions.
107 changes: 92 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,110 @@ const { resolve } = require("node:path");

const project = resolve(process.cwd(), "tsconfig.json");
/** @type {import("eslint").Linter.Config} */

module.exports = {
extends: ["eslint:recommended", "prettier", "eslint-config-turbo"],
plugins: ["only-warn"],
parser: "@typescript-eslint/parser",
parserOptions: {
project,
},
extends: [
"eslint:recommended",
"plugin:storybook/recommended",
"plugin:import/recommended",
"plugin:react-hooks/recommended",
"plugin:import/typescript",
"plugin:jsx-a11y/recommended",
"plugin:prettier/recommended",
"eslint-config-turbo",
],
plugins: [
"@typescript-eslint/eslint-plugin",
"react",
"only-warn",
"simple-import-sort",
],
globals: {
React: true,
JSX: true,
},
env: {
browser: true,
node: true,
es6: true,
commonjs: true,
},
rules: {
"no-unused-vars": "error",
eqeqeq: [
"error",
"always",
{
null: "ignore",
},
],
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"react/function-component-definition": [
"error",
{
namedComponents: "arrow-function",
},
],
"react/jsx-curly-brace-presence": [
"error",
{
props: "never",
children: "never",
},
],
"react/jsx-sort-props": [
"error",
{
callbacksLast: true,
multiline: "last",
shorthandFirst: true,
},
],
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/naming-convention": [
"error",
{
format: ["camelCase", "UPPER_CASE", "PascalCase"],
selector: "variable",
leadingUnderscore: "allow",
},
{
format: ["camelCase", "PascalCase"],
selector: "function",
},
{
format: ["PascalCase"],
selector: "interface",
},
{
format: ["PascalCase"],
selector: "typeAlias",
},
],
"@typescript-eslint/no-empty-function": "warn",
"import/no-duplicates": "error",
"import/namespace": [
"error",
{
allowComputed: true,
},
],
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
},

settings: {
"import/ignore": ["^@styled-system/css/css"],
"import/resolver": {
typescript: {
project,
},
typescript: { project },
},
},

ignorePatterns: [
".*.js",
"node_modules/",
Expand All @@ -28,14 +115,4 @@ module.exports = {
"panda.config.ts",
"rollup.config.cjs",
],
overrides: [
{
files: ["*.js?(x)", "*.ts?(x)"],
},
],

parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
};
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"singleQuote": false,
"semi": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "es5",
"printWidth": 80,
"arrowParens": "always"
}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"source.fixAll.eslint": "explicit",
"source.fixAll.stylelint": "explicit"
},
"eslint.workingDirectories": [{ "mode": "auto" }],
"editor.formatOnSave": true,
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.tsdk": "node_modules/typescript/lib"
Expand Down
24 changes: 23 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"prerelease": "pnpm changeset version",
"release": "pnpm publish -r --no-git-checks"
"release": "pnpm publish -r --no-git-checks",
"prepare": "husky install"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"eslint --cache --fix",
"prettier --cache --write"
]
},
"devDependencies": {
"@changesets/changelog-git": "^0.2.0",
Expand All @@ -23,8 +30,23 @@
"@types/react-dom": "^18.2.19",
"@types/rollup-plugin-peer-deps-external": "^2.2.5",
"@types/rollup-plugin-url": "^3.0.5",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.1.0",
"babel-preset-react-app": "^10.0.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-turbo": "^1.13.3",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-simple-import-sort": "^12.1.0",
"eslint-plugin-storybook": "^0.6.15",
"husky": "^8.0.0",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"rollup": "^4.17.2",
"rollup-plugin-babel": "^4.4.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/wow-icons/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import json from "@rollup/plugin-json";
import terser from "@rollup/plugin-terser";
import svgr from "@svgr/rollup";
import babel from "rollup-plugin-babel";
import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
import svgr from "@svgr/rollup";
import url from "rollup-plugin-url";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import terser from "@rollup/plugin-terser";
import json from "@rollup/plugin-json";
import url from "rollup-plugin-url";

const extensions = [".ts", ".tsx", ".js", ".jsx"];

Expand Down
6 changes: 3 additions & 3 deletions packages/wow-tokens/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json from "@rollup/plugin-json";
import terser from "@rollup/plugin-terser";
import babel from "rollup-plugin-babel";
import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import terser from "@rollup/plugin-terser";
import json from "@rollup/plugin-json";

const extensions = [".ts", ".tsx", ".js", ".jsx"];

Expand Down
2 changes: 1 addition & 1 deletion packages/wow-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"import": "./dist/Button.js"
}
},
"type": "module",
"keywords": [],
"license": "ISC",
"scripts": {
Expand All @@ -56,7 +57,6 @@
"@storybook/test-runner": "^0.18.0",
"@storybook/testing-library": "^0.2.2",
"@turbo/gen": "^1.12.4",
"@types/eslint": "^8.56.5",
"@types/node": "^20.11.24",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
Expand Down
14 changes: 7 additions & 7 deletions packages/wow-ui/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import alias from "@rollup/plugin-alias";
import json from "@rollup/plugin-json";
import terser from "@rollup/plugin-terser";
import svgr from "@svgr/rollup";
import path from "path";
import babel from "rollup-plugin-babel";
import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
import svgr from "@svgr/rollup";
import url from "rollup-plugin-url";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import terser from "@rollup/plugin-terser";
import json from "@rollup/plugin-json";
import alias from "@rollup/plugin-alias";
import typescript from "rollup-plugin-typescript2";
import url from "rollup-plugin-url";
import { fileURLToPath } from "url";
import path from "path";

const extensions = [".tsx", ".ts", ".js", ".jsx"];
const __dirname = path.dirname(fileURLToPath(import.meta.url));
Expand Down
1 change: 1 addition & 0 deletions packages/wow-ui/src/components/Box/Box.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";

import Box from "@/components/Box";

const meta = {
Expand Down
3 changes: 2 additions & 1 deletion packages/wow-ui/src/components/Box/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { ReactNode } from "react";
import { css } from "@styled-system/css/css";
import type { ReactNode } from "react";

export interface ButtonProps {
children: ReactNode;
}

const Box = ({ children }: ButtonProps) => {
return (
<button
Expand Down
1 change: 1 addition & 0 deletions packages/wow-ui/src/components/Button/Button.stories.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Meta, StoryObj } from "@storybook/react";

import Button from "@/components/Button";

const meta = {
Expand Down
2 changes: 1 addition & 1 deletion packages/wow-ui/src/components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from "react";
import { css } from "@styled-system/css/css";
import type { ReactNode } from "react";

export interface ButtonProps {
children: ReactNode;
Expand Down
Loading

0 comments on commit 37bca64

Please sign in to comment.