Skip to content

Commit

Permalink
chore: next.js, react-internal, library eslint 설정 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
semnil5202 committed Jun 22, 2024
1 parent 6bae868 commit 32a83e1
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 49 deletions.
34 changes: 22 additions & 12 deletions packages/core/eslint-config/library.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const { resolve } = require("node:path");
const { resolve } = require('node:path');

const project = resolve(process.cwd(), "tsconfig.json");
const project = resolve(process.cwd(), 'tsconfig.json');

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["eslint:recommended", "prettier", "turbo"],
plugins: ["only-warn"],
extends: ['eslint:recommended', 'prettier', 'turbo'],
plugins: ['@typescript-eslint', 'only-warn', 'import'],
globals: {
React: true,
JSX: true,
Expand All @@ -14,21 +14,31 @@ module.exports = {
node: true,
},
settings: {
"import/resolver": {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
],
ignorePatterns: ['.*.js', 'node_modules/', 'dist/'],
rules: {
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'object', 'type'],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
},
],
'no-unused-vars': ['warn', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
'@typescript-eslint/consistent-type-imports': 'warn',
},
overrides: [
{
files: ["*.js?(x)", "*.ts?(x)"],
files: ['*.js?(x)', '*.ts?(x)'],
},
],
};
38 changes: 22 additions & 16 deletions packages/core/eslint-config/next.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
const { resolve } = require("node:path");
const { resolve } = require('node:path');

const project = resolve(process.cwd(), "tsconfig.json");
const project = resolve(process.cwd(), 'tsconfig.json');

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: [
"eslint:recommended",
"prettier",
require.resolve("@vercel/style-guide/eslint/next"),
"turbo",
],
extends: ['eslint:recommended', 'prettier', require.resolve('@vercel/style-guide/eslint/next'), 'turbo'],
plugins: ['@typescript-eslint', 'only-warn', 'import'],
globals: {
React: true,
JSX: true,
Expand All @@ -18,18 +14,28 @@ module.exports = {
node: true,
browser: true,
},
plugins: ["only-warn"],
settings: {
"import/resolver": {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
],
overrides: [{ files: ["*.js?(x)", "*.ts?(x)"] }],
ignorePatterns: ['.*.js', 'node_modules/'],
rules: {
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'object', 'type'],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
},
],
'no-unused-vars': ['warn', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
'@typescript-eslint/consistent-type-imports': 'warn',
},
overrides: [{ files: ['*.js?(x)', '*.ts?(x)'] }],
};
43 changes: 22 additions & 21 deletions packages/core/eslint-config/react-internal.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
const { resolve } = require("node:path");
const { resolve } = require('node:path');

const project = resolve(process.cwd(), "tsconfig.json");

/*
* This is a custom ESLint configuration for use with
* internal (bundled by their consumer) libraries
* that utilize React.
*/
const project = resolve(process.cwd(), 'tsconfig.json');

/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: ["eslint:recommended", "prettier", "turbo"],
plugins: ["only-warn"],
extends: ['eslint:recommended', 'prettier', 'turbo'],
plugins: ['@typescript-eslint', 'only-warn', 'import'],
globals: {
React: true,
JSX: true,
Expand All @@ -20,20 +14,27 @@ module.exports = {
browser: true,
},
settings: {
"import/resolver": {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
],
overrides: [
// Force ESLint to detect .tsx files
{ files: ["*.js?(x)", "*.ts?(x)"] },
],
ignorePatterns: ['.*.js', 'node_modules/', 'dist/'],
rules: {
'import/order': [
'warn',
{
groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'object', 'type'],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
},
],
'no-unused-vars': ['warn', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }],
'@typescript-eslint/consistent-type-imports': 'warn',
},
overrides: [{ files: ['*.js?(x)', '*.ts?(x)'] }],
};

0 comments on commit 32a83e1

Please sign in to comment.