@tapie-kr/code-guideline-base
Version:
TAPIE Code Style Standards - Base Configuration
442 lines (435 loc) • 12.8 kB
JavaScript
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// index.mjs
var index_exports = {};
__export(index_exports, {
default: () => index_default
});
module.exports = __toCommonJS(index_exports);
var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
// configs/format.mjs
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
var import_eslint_plugin_newline_destructuring = __toESM(require("eslint-plugin-newline-destructuring"), 1);
var config = {
plugins: {
"@stylistic": import_eslint_plugin.default,
"newline-destructuring": import_eslint_plugin_newline_destructuring.default
},
files: ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"],
rules: {
"@stylistic/array-bracket-newline": [
"error",
{
minItems: 3,
multiline: true
}
],
"@stylistic/array-bracket-spacing": ["error", "never"],
"@stylistic/array-element-newline": [
"error",
{
minItems: 3,
multiline: true
}
],
"@stylistic/arrow-parens": ["error", "as-needed"],
"@stylistic/arrow-spacing": [
"error",
{
after: true,
before: true
}
],
"@stylistic/block-spacing": ["error", "always"],
"@stylistic/brace-style": ["error", "1tbs"],
"@stylistic/comma-dangle": ["error", "always-multiline"],
"@stylistic/comma-spacing": [
"error",
{
after: true,
before: false
}
],
"@stylistic/comma-style": ["error", "last"],
"@stylistic/computed-property-spacing": ["error", "never"],
"@stylistic/curly-newline": ["error", "always"],
"@stylistic/dot-location": ["error", "property"],
"@stylistic/eol-last": ["error", "always"],
"@stylistic/function-call-argument-newline": ["error", "consistent"],
"@stylistic/function-call-spacing": ["error", "never"],
"@stylistic/function-paren-newline": ["error", { minItems: 5 }],
"@stylistic/generator-star-spacing": [
"error",
{
after: true,
before: false
}
],
"@stylistic/implicit-arrow-linebreak": ["error", "beside"],
"@stylistic/indent": ["error", 2],
"@stylistic/indent-binary-ops": ["error", 2],
"@stylistic/key-spacing": [
"error",
{ align: {
beforeColon: false,
afterColon: true,
mode: "strict",
on: "value"
} }
],
"@stylistic/keyword-spacing": [
"error",
{
before: true,
after: true
}
],
"@stylistic/line-comment-position": "error",
"@stylistic/linebreak-style": ["error", "unix"],
"@stylistic/lines-around-comment": [
"error",
{
beforeLineComment: true,
allowClassStart: false,
allowClassEnd: false,
allowObjectStart: false,
allowObjectEnd: false,
allowArrayStart: false,
allowArrayEnd: false,
allowBlockStart: true,
allowBlockEnd: false,
allowEnumStart: false,
allowEnumEnd: false,
allowInterfaceStart: false,
allowInterfaceEnd: false,
allowModuleStart: false,
allowModuleEnd: false,
allowTypeStart: false,
allowTypeEnd: false,
applyDefaultIgnorePatterns: false,
afterHashbangComment: true
}
],
"@stylistic/lines-between-class-members": [
"error",
{ enforce: [
{
blankLine: "never",
prev: "method",
next: "method"
}
] }
],
"@stylistic/max-len": [
"error",
{
code: Number.POSITIVE_INFINITY,
tabWidth: 2,
comments: 100,
ignoreComments: true,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true
}
],
"@stylistic/max-statements-per-line": [
"error",
{
max: 1,
ignoredNodes: [
"BreakStatement",
"ContinueStatement",
"ReturnStatement"
]
}
],
"@stylistic/member-delimiter-style": "error",
"@stylistic/multiline-comment-style": ["error", "starred-block"],
"@stylistic/multiline-ternary": ["error", "always-multiline"],
"@stylistic/new-parens": ["error", "never"],
"@stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 2 }],
"@stylistic/no-confusing-arrow": ["error", { onlyOneSimpleParam: true }],
"@stylistic/no-extra-parens": [
"error",
"all",
{
nestedBinaryExpressions: false,
ternaryOperandBinaryExpressions: false,
ignoreJSX: "multi-line",
nestedConditionalExpressions: false,
enforceForArrowConditionals: false
}
],
"@stylistic/no-extra-semi": "error",
"@stylistic/no-floating-decimal": "error",
"@stylistic/no-mixed-operators": "error",
"@stylistic/no-mixed-spaces-and-tabs": "error",
"@stylistic/no-multi-spaces": "off",
"@stylistic/no-multiple-empty-lines": [
"error",
{
max: 1,
maxBOF: 0,
maxEOF: 1
}
],
"@stylistic/no-tabs": "error",
"@stylistic/no-trailing-spaces": "error",
"@stylistic/no-whitespace-before-property": "error",
"@stylistic/nonblock-statement-body-position": ["error", "beside"],
"@stylistic/object-curly-newline": [
"error",
{
ObjectExpression: { minProperties: 2 },
ObjectPattern: { minProperties: 3 },
ImportDeclaration: { minProperties: 4 },
ExportDeclaration: "always",
TSTypeLiteral: "always",
TSInterfaceBody: "always"
}
],
"@stylistic/object-curly-spacing": [
"error",
"always",
{ arraysInObjects: true }
],
"@stylistic/object-property-newline": [
"error",
{
allowAllPropertiesOnSameLine: true,
allowMultiplePropertiesPerLine: true
}
],
"@stylistic/one-var-declaration-per-line": ["error", "always"],
"@stylistic/operator-linebreak": [
"error",
"after",
{ overrides: {
"?": "before",
":": "before"
} }
],
"@stylistic/padded-blocks": ["error", "never"],
"@stylistic/quote-props": ["error", "as-needed"],
"@stylistic/quotes": [
"error",
"single",
{ avoidEscape: true }
],
"@stylistic/rest-spread-spacing": "error",
"@stylistic/semi": "error",
"@stylistic/semi-spacing": [
"error",
{
before: false,
after: true
}
],
"@stylistic/semi-style": "error",
"@stylistic/space-before-blocks": "error",
"@stylistic/space-before-function-paren": [
"error",
{
anonymous: "never",
named: "never",
asyncArrow: "always"
}
],
"@stylistic/space-in-parens": "error",
"@stylistic/space-infix-ops": "error",
"@stylistic/space-unary-ops": "error",
"@stylistic/spaced-comment": ["error", "always"],
"@stylistic/switch-colon-spacing": "error",
"@stylistic/template-curly-spacing": "error",
"@stylistic/template-tag-spacing": "error",
"@stylistic/type-annotation-spacing": "error",
"@stylistic/type-generic-spacing": "error",
"@stylistic/type-named-tuple-spacing": "error",
"@stylistic/wrap-iife": ["error", "inside"],
"@stylistic/wrap-regex": "error",
"@stylistic/yield-star-spacing": ["error", "after"],
"newline-destructuring/newline": ["error", { itemsWithRest: 2 }]
}
};
var format_default = config;
// configs/import.mjs
var import_eslint_plugin_import_newlines = __toESM(require("eslint-plugin-import-newlines"), 1);
var import_eslint_plugin_simple_import_sort = __toESM(require("eslint-plugin-simple-import-sort"), 1);
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
var config2 = {
plugins: {
"simple-import-sort": import_eslint_plugin_simple_import_sort.default,
"import-newlines": import_eslint_plugin_import_newlines.default,
"unused-imports": import_eslint_plugin_unused_imports.default
},
settings: { "import/resolver": {
typescript: {},
node: { extensions: [
".js",
".mjs",
".cjs",
".jsx",
".ts",
".mts",
".cts",
".tsx"
] }
} },
rules: {
"simple-import-sort/imports": [
"error",
{ groups: [
["^.+\\.css$"],
[
"^@cottons-kr/react-foundation",
"@tapie-kr/inspire-react",
"^@/components/(?!.*?/shared$)"
],
[
"^@?\\w",
"^@/",
"^\\."
],
["^\\u0000"]
] }
],
"import-newlines/enforce": ["error", { items: 3 }],
"unused-imports/no-unused-imports": "error",
"no-restricted-imports": ["error", { patterns: ["../../*"] }],
"no-restricted-syntax": [
"error",
{
selector: ":not(ImportDeclaration[source.value=/.css$/]) > ImportNamespaceSpecifier",
message: "Importing entire module is not allowed."
}
]
}
};
var import_default = config2;
// configs/padding-line.mjs
var import_eslint_plugin2 = __toESM(require("@stylistic/eslint-plugin"), 1);
var config3 = {
plugins: { "@stylistic": import_eslint_plugin2.default },
files: ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"],
rules: { "@stylistic/padding-line-between-statements": [
"error",
{
blankLine: "always",
prev: "*",
next: "*"
},
{
blankLine: "any",
prev: "import",
next: "import"
},
{
blankLine: "never",
prev: "singleline-export",
next: "singleline-export"
},
{
blankLine: "never",
prev: "singleline-const",
next: "singleline-const"
},
{
blankLine: "never",
prev: "let",
next: "let"
}
] }
};
var padding_line_default = config3;
// configs/restrict.mjs
var import_eslint_plugin3 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
var defaultConfig = { rules: {
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-debugger": "error",
"no-alert": "error",
"no-var": "error",
"no-duplicate-imports": "error"
} };
var typescriptConfig = {
plugins: { "@typescript-eslint": import_eslint_plugin3.default },
files: ["**/*.{ts,mts,cts,tsx}"],
rules: {
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
argsIgnorePattern: "^_"
}
]
}
};
var javascriptConfig = {
plugins: { "@typescript-eslint": import_eslint_plugin3.default },
files: ["**/*.{js,mjs,cjs,jsx}"],
rules: {
"no-unused-vars": [
"error",
{
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
argsIgnorePattern: "^_"
}
],
"no-redeclare": "error"
}
};
var restrict_default = [
defaultConfig,
typescriptConfig,
javascriptConfig
];
// index.mjs
var config4 = [
{ languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
parser: import_parser.default,
parserOptions: { ecmaFeatures: { jsx: true } }
} },
{ ignores: [
"**/node_modules/**",
"**/dist/**",
"**/build/**"
] },
format_default,
import_default,
padding_line_default,
...restrict_default
];
var index_default = config4;