create-twenty-app 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cli.cjs +3 -3
- package/dist/cli.mjs +9 -5
- package/dist/constants/base-application/eslint.config.mjs +12 -120
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,7 @@ Create Twenty App is the official scaffolding CLI for building apps on top of [T
|
|
|
23
23
|
- A Twenty workspace and an API key (create one at https://app.twenty.com/settings/api-webhooks)
|
|
24
24
|
|
|
25
25
|
## Quick start
|
|
26
|
+
|
|
26
27
|
```bash
|
|
27
28
|
npx create-twenty-app@latest my-twenty-app
|
|
28
29
|
cd my-twenty-app
|
package/dist/cli.cjs
CHANGED
|
@@ -36,7 +36,7 @@ yarn-error.log*
|
|
|
36
36
|
|
|
37
37
|
# typescript
|
|
38
38
|
*.tsbuildinfo
|
|
39
|
-
`)},Kv=async({displayName:a,appDirectory:y,defaultServerlessFunctionRoleUniversalIdentifier:o})=>{const S=`import {
|
|
39
|
+
`)},Kv=async({displayName:a,appDirectory:y,defaultServerlessFunctionRoleUniversalIdentifier:o})=>{const S=`import { type RoleConfig } from 'twenty-sdk';
|
|
40
40
|
|
|
41
41
|
export const functionRole: RoleConfig = {
|
|
42
42
|
universalIdentifier: '${o}',
|
|
@@ -57,7 +57,7 @@ const config: ApplicationConfig = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
export default config;
|
|
60
|
-
`;await wr.writeFile(qr.join(o,"application.config.ts"),R)},kv=async({appName:a,appDirectory:y})=>{const o={name:a,version:"0.1.0",license:"MIT",engines:{node:"^24.5.0",npm:"please-use-yarn",yarn:">=4.0.2"},packageManager:"yarn@4.9.2",scripts:{"create-entity":"twenty app add",dev:"twenty app dev",generate:"twenty app generate",sync:"twenty app sync",logs:"twenty app logs",uninstall:"twenty app uninstall",help:"twenty help",auth:"twenty auth login"},dependencies:{"twenty-sdk":"0.2.
|
|
60
|
+
`;await wr.writeFile(qr.join(o,"application.config.ts"),R)},kv=async({appName:a,appDirectory:y})=>{const o={name:a,version:"0.1.0",license:"MIT",engines:{node:"^24.5.0",npm:"please-use-yarn",yarn:">=4.0.2"},packageManager:"yarn@4.9.2",scripts:{"create-entity":"twenty app add",dev:"twenty app dev",generate:"twenty app generate",sync:"twenty app sync",logs:"twenty app logs",uninstall:"twenty app uninstall",help:"twenty help",auth:"twenty auth login",lint:"eslint","lint-fix":"eslint --fix"},dependencies:{"twenty-sdk":"0.2.4"},devDependencies:{typescript:"^5.9.3","@types/node":"^24.7.2",eslint:"^9.32.0","typescript-eslint":"^8.50.0"}};await wr.writeFile(qr.join(y,"package.json"),JSON.stringify(o,null,2),"utf8")};var be=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},We={exports:{}};/**
|
|
61
61
|
* @license
|
|
62
62
|
* Lodash <https://lodash.com/>
|
|
63
63
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
@@ -92,4 +92,4 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
92
92
|
`))):N=h.stylize("[Circular]","special")),X(j)){if(un&&V.match(/^\d+$/))return N;j=JSON.stringify(""+V),j.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(j=j.slice(1,-1),j=h.stylize(j,"name")):(j=j.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),j=h.stylize(j,"string"))}return j+": "+N}function pn(h,_,b){var q=h.reduce(function(V,un){return un.indexOf(`
|
|
93
93
|
`)>=0,V+un.replace(/\u001b\[\d\d?m/g,"").length+1},0);return q>60?b[0]+(_===""?"":_+`
|
|
94
94
|
`)+" "+h.join(`,
|
|
95
|
-
`)+" "+b[1]:b[0]+_+" "+h.join(", ")+" "+b[1]}a.types=C_();function G(h){return Array.isArray(h)}a.isArray=G;function H(h){return typeof h=="boolean"}a.isBoolean=H;function nn(h){return h===null}a.isNull=nn;function M(h){return h==null}a.isNullOrUndefined=M;function an(h){return typeof h=="number"}a.isNumber=an;function Rn(h){return typeof h=="string"}a.isString=Rn;function Mn(h){return typeof h=="symbol"}a.isSymbol=Mn;function X(h){return h===void 0}a.isUndefined=X;function Gn(h){return Jn(h)&&En(h)==="[object RegExp]"}a.isRegExp=Gn,a.types.isRegExp=Gn;function Jn(h){return typeof h=="object"&&h!==null}a.isObject=Jn;function yr(h){return Jn(h)&&En(h)==="[object Date]"}a.isDate=yr,a.types.isDate=yr;function Hn(h){return Jn(h)&&(En(h)==="[object Error]"||h instanceof Error)}a.isError=Hn,a.types.isNativeError=Hn;function Cn(h){return typeof h=="function"}a.isFunction=Cn;function Zr(h){return h===null||typeof h=="boolean"||typeof h=="number"||typeof h=="string"||typeof h=="symbol"||typeof h>"u"}a.isPrimitive=Zr,a.isBuffer=B_();function En(h){return Object.prototype.toString.call(h)}function Er(h){return h<10?"0"+h.toString(10):h.toString(10)}var mr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function kn(){var h=new Date,_=[Er(h.getHours()),Er(h.getMinutes()),Er(h.getSeconds())].join(":");return[h.getDate(),mr[h.getMonth()],_].join(" ")}a.log=function(){console.log("%s - %s",kn(),a.format.apply(a,arguments))},a.inherits=F_(),a._extend=function(h,_){if(!_||!Jn(_))return h;for(var b=Object.keys(_),q=b.length;q--;)h[b[q]]=_[b[q]];return h};function bn(h,_){return Object.prototype.hasOwnProperty.call(h,_)}var qn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;a.promisify=function(_){if(typeof _!="function")throw new TypeError('The "original" argument must be of type Function');if(qn&&_[qn]){var b=_[qn];if(typeof b!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(b,qn,{value:b,enumerable:!1,writable:!1,configurable:!0}),b}function b(){for(var q,V,un=new Promise(function(L,rn){q=L,V=rn}),j=[],N=0;N<arguments.length;N++)j.push(arguments[N]);j.push(function(L,rn){L?V(L):q(rn)});try{_.apply(this,j)}catch(L){V(L)}return un}return Object.setPrototypeOf(b,Object.getPrototypeOf(_)),qn&&Object.defineProperty(b,qn,{value:b,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(b,y(_))},a.promisify.custom=qn;function Qn(h,_){if(!h){var b=new Error("Promise was rejected with a falsy value");b.reason=h,h=b}return _(h)}function Fn(h){if(typeof h!="function")throw new TypeError('The "original" argument must be of type Function');function _(){for(var b=[],q=0;q<arguments.length;q++)b.push(arguments[q]);var V=b.pop();if(typeof V!="function")throw new TypeError("The last argument must be of type Function");var un=this,j=function(){return V.apply(un,arguments)};h.apply(this,b).then(function(N){process.nextTick(j.bind(null,null,N))},function(N){process.nextTick(Qn.bind(null,N,j))})}return Object.setPrototypeOf(_,Object.getPrototypeOf(h)),Object.defineProperties(_,y(h)),_}a.callbackify=Fn}(ru)),ru}var nl=D_();const Yr=nl.promisify(Hs.exec),L_=async a=>{try{return await Yr("git rev-parse --is-inside-work-tree",{cwd:a}),!0}catch{}return!1},U_=async a=>{try{return await Yr("hg --cwd . root",{cwd:a}),!0}catch{}return!1},M_=async a=>{try{return await Yr("git config init.defaultBranch",{cwd:a}),!0}catch{}return!1},q_=async a=>{try{if(await Yr("git --version",{cwd:a}),await L_(a)||await U_(a))return!1;await Yr("git init",{cwd:a});try{return await M_(a)||await Yr("git checkout -b main",{cwd:a}),await Yr("git add -A",{cwd:a}),await Yr('git commit -m "Initial commit from Create Twenty App"',{cwd:a}),!0}catch{return wr.rm(qr.join(a,".git"),{recursive:!0,force:!0}),!1}}catch{return!1}},N_=nl.promisify(Hs.exec),W_=async a=>{try{await N_("yarn",{cwd:a})}catch(y){console.error(Mr.default.red("yarn install failed:"),y.stdout)}},Ns=process.env.INIT_CWD||process.cwd();class $_{async execute(y){try{const{appName:o,appDisplayName:S,appDirectory:R,appDescription:F}=await this.getAppInfos(y);await this.validateDirectory(R),this.logCreationInfo({appDirectory:R,appName:o}),await wr.ensureDir(R),await Hv({appName:o,appDisplayName:S,appDescription:F,appDirectory:R}),await W_(R),await q_(R),this.logSuccess(R)}catch(o){console.error(Mr.default.red("Initialization failed:"),o instanceof Error?o.message:o),process.exit(1)}}async getAppInfos(y){const{name:o,displayName:S,description:R}=await Wv.default.prompt([{type:"input",name:"name",message:"Application name:",when:()=>!y,default:"my-awesome-app",validate:C=>C.length===0?"Application name is required":!0},{type:"input",name:"displayName",message:"Application display name:",default:C=>Vv(C?.name??y)},{type:"input",name:"description",message:"Application description (optional):",default:""}]),E=(o??y).trim(),P=S.trim(),O=R.trim(),D=y?Ma.join(Ns,y):Ma.join(Ns,$v.default(E));return{appName:E,appDisplayName:P,appDirectory:D,appDescription:O}}async validateDirectory(y){if(!await wr.pathExists(y))return;if((await wr.readdir(y)).length>0)throw new Error(`Directory ${y} already exists and is not empty`)}logCreationInfo({appDirectory:y,appName:o}){console.log(Mr.default.blue("🎯 Creating Twenty Application")),console.log(Mr.default.gray(`📁 Directory: ${y}`)),console.log(Mr.default.gray(`📝 Name: ${o}`)),console.log("")}logSuccess(y){console.log(Mr.default.green("✅ Application created!")),console.log(""),console.log(Mr.default.blue("Next steps:")),console.log(`cd ${y.split("/").reverse()[0]??""}`),console.log("yarn auth")}}const G_="create-twenty-app",H_="0.2.
|
|
95
|
+
`)+" "+b[1]:b[0]+_+" "+h.join(", ")+" "+b[1]}a.types=C_();function G(h){return Array.isArray(h)}a.isArray=G;function H(h){return typeof h=="boolean"}a.isBoolean=H;function nn(h){return h===null}a.isNull=nn;function M(h){return h==null}a.isNullOrUndefined=M;function an(h){return typeof h=="number"}a.isNumber=an;function Rn(h){return typeof h=="string"}a.isString=Rn;function Mn(h){return typeof h=="symbol"}a.isSymbol=Mn;function X(h){return h===void 0}a.isUndefined=X;function Gn(h){return Jn(h)&&En(h)==="[object RegExp]"}a.isRegExp=Gn,a.types.isRegExp=Gn;function Jn(h){return typeof h=="object"&&h!==null}a.isObject=Jn;function yr(h){return Jn(h)&&En(h)==="[object Date]"}a.isDate=yr,a.types.isDate=yr;function Hn(h){return Jn(h)&&(En(h)==="[object Error]"||h instanceof Error)}a.isError=Hn,a.types.isNativeError=Hn;function Cn(h){return typeof h=="function"}a.isFunction=Cn;function Zr(h){return h===null||typeof h=="boolean"||typeof h=="number"||typeof h=="string"||typeof h=="symbol"||typeof h>"u"}a.isPrimitive=Zr,a.isBuffer=B_();function En(h){return Object.prototype.toString.call(h)}function Er(h){return h<10?"0"+h.toString(10):h.toString(10)}var mr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function kn(){var h=new Date,_=[Er(h.getHours()),Er(h.getMinutes()),Er(h.getSeconds())].join(":");return[h.getDate(),mr[h.getMonth()],_].join(" ")}a.log=function(){console.log("%s - %s",kn(),a.format.apply(a,arguments))},a.inherits=F_(),a._extend=function(h,_){if(!_||!Jn(_))return h;for(var b=Object.keys(_),q=b.length;q--;)h[b[q]]=_[b[q]];return h};function bn(h,_){return Object.prototype.hasOwnProperty.call(h,_)}var qn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;a.promisify=function(_){if(typeof _!="function")throw new TypeError('The "original" argument must be of type Function');if(qn&&_[qn]){var b=_[qn];if(typeof b!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(b,qn,{value:b,enumerable:!1,writable:!1,configurable:!0}),b}function b(){for(var q,V,un=new Promise(function(L,rn){q=L,V=rn}),j=[],N=0;N<arguments.length;N++)j.push(arguments[N]);j.push(function(L,rn){L?V(L):q(rn)});try{_.apply(this,j)}catch(L){V(L)}return un}return Object.setPrototypeOf(b,Object.getPrototypeOf(_)),qn&&Object.defineProperty(b,qn,{value:b,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(b,y(_))},a.promisify.custom=qn;function Qn(h,_){if(!h){var b=new Error("Promise was rejected with a falsy value");b.reason=h,h=b}return _(h)}function Fn(h){if(typeof h!="function")throw new TypeError('The "original" argument must be of type Function');function _(){for(var b=[],q=0;q<arguments.length;q++)b.push(arguments[q]);var V=b.pop();if(typeof V!="function")throw new TypeError("The last argument must be of type Function");var un=this,j=function(){return V.apply(un,arguments)};h.apply(this,b).then(function(N){process.nextTick(j.bind(null,null,N))},function(N){process.nextTick(Qn.bind(null,N,j))})}return Object.setPrototypeOf(_,Object.getPrototypeOf(h)),Object.defineProperties(_,y(h)),_}a.callbackify=Fn}(ru)),ru}var nl=D_();const Yr=nl.promisify(Hs.exec),L_=async a=>{try{return await Yr("git rev-parse --is-inside-work-tree",{cwd:a}),!0}catch{}return!1},U_=async a=>{try{return await Yr("hg --cwd . root",{cwd:a}),!0}catch{}return!1},M_=async a=>{try{return await Yr("git config init.defaultBranch",{cwd:a}),!0}catch{}return!1},q_=async a=>{try{if(await Yr("git --version",{cwd:a}),await L_(a)||await U_(a))return!1;await Yr("git init",{cwd:a});try{return await M_(a)||await Yr("git checkout -b main",{cwd:a}),await Yr("git add -A",{cwd:a}),await Yr('git commit -m "Initial commit from Create Twenty App"',{cwd:a}),!0}catch{return wr.rm(qr.join(a,".git"),{recursive:!0,force:!0}),!1}}catch{return!1}},N_=nl.promisify(Hs.exec),W_=async a=>{try{await N_("yarn",{cwd:a})}catch(y){console.error(Mr.default.red("yarn install failed:"),y.stdout)}},Ns=process.env.INIT_CWD||process.cwd();class $_{async execute(y){try{const{appName:o,appDisplayName:S,appDirectory:R,appDescription:F}=await this.getAppInfos(y);await this.validateDirectory(R),this.logCreationInfo({appDirectory:R,appName:o}),await wr.ensureDir(R),await Hv({appName:o,appDisplayName:S,appDescription:F,appDirectory:R}),await W_(R),await q_(R),this.logSuccess(R)}catch(o){console.error(Mr.default.red("Initialization failed:"),o instanceof Error?o.message:o),process.exit(1)}}async getAppInfos(y){const{name:o,displayName:S,description:R}=await Wv.default.prompt([{type:"input",name:"name",message:"Application name:",when:()=>!y,default:"my-awesome-app",validate:C=>C.length===0?"Application name is required":!0},{type:"input",name:"displayName",message:"Application display name:",default:C=>Vv(C?.name??y)},{type:"input",name:"description",message:"Application description (optional):",default:""}]),E=(o??y).trim(),P=S.trim(),O=R.trim(),D=y?Ma.join(Ns,y):Ma.join(Ns,$v.default(E));return{appName:E,appDisplayName:P,appDirectory:D,appDescription:O}}async validateDirectory(y){if(!await wr.pathExists(y))return;if((await wr.readdir(y)).length>0)throw new Error(`Directory ${y} already exists and is not empty`)}logCreationInfo({appDirectory:y,appName:o}){console.log(Mr.default.blue("🎯 Creating Twenty Application")),console.log(Mr.default.gray(`📁 Directory: ${y}`)),console.log(Mr.default.gray(`📝 Name: ${o}`)),console.log("")}logSuccess(y){console.log(Mr.default.green("✅ Application created!")),console.log(""),console.log(Mr.default.blue("Next steps:")),console.log(`cd ${y.split("/").reverse()[0]??""}`),console.log("yarn auth")}}const G_="create-twenty-app",H_="0.2.4",Ws={name:G_,version:H_},rl=new $s.Command(Ws.name).description("CLI tool to initialize a new Twenty application").version(Ws.version,"-v, --version","Output the current version of create-twenty-app.").argument("[directory]").helpOption("-h, --help","Display this help message.").action(async a=>{a&&!/^[a-z0-9-]+$/.test(a)&&(console.error(Mr.default.red(`Invalid directory "${a}". Must contain only lowercase letters, numbers, and hyphens`)),process.exit(1)),await new $_().execute(a)});rl.exitOverride();try{rl.parse()}catch(a){a instanceof $s.CommanderError&&process.exit(a.exitCode),a instanceof Error&&(console.error(Mr.default.red("Error:"),a.message),process.exit(1))}
|
package/dist/cli.mjs
CHANGED
|
@@ -74,7 +74,7 @@ yarn-error.log*
|
|
|
74
74
|
appDirectory: y,
|
|
75
75
|
defaultServerlessFunctionRoleUniversalIdentifier: o
|
|
76
76
|
}) => {
|
|
77
|
-
const S = `import {
|
|
77
|
+
const S = `import { type RoleConfig } from 'twenty-sdk';
|
|
78
78
|
|
|
79
79
|
export const functionRole: RoleConfig = {
|
|
80
80
|
universalIdentifier: '${o}',
|
|
@@ -127,14 +127,18 @@ export default config;
|
|
|
127
127
|
logs: "twenty app logs",
|
|
128
128
|
uninstall: "twenty app uninstall",
|
|
129
129
|
help: "twenty help",
|
|
130
|
-
auth: "twenty auth login"
|
|
130
|
+
auth: "twenty auth login",
|
|
131
|
+
lint: "eslint",
|
|
132
|
+
"lint-fix": "eslint --fix"
|
|
131
133
|
},
|
|
132
134
|
dependencies: {
|
|
133
|
-
"twenty-sdk": "0.2.
|
|
135
|
+
"twenty-sdk": "0.2.4"
|
|
134
136
|
},
|
|
135
137
|
devDependencies: {
|
|
138
|
+
typescript: "^5.9.3",
|
|
136
139
|
"@types/node": "^24.7.2",
|
|
137
|
-
|
|
140
|
+
eslint: "^9.32.0",
|
|
141
|
+
"typescript-eslint": "^8.50.0"
|
|
138
142
|
}
|
|
139
143
|
};
|
|
140
144
|
await Ar.writeFile(
|
|
@@ -5430,7 +5434,7 @@ class U_ {
|
|
|
5430
5434
|
console.log(Mr.green("✅ Application created!")), console.log(""), console.log(Mr.blue("Next steps:")), console.log(`cd ${y.split("/").reverse()[0] ?? ""}`), console.log("yarn auth");
|
|
5431
5435
|
}
|
|
5432
5436
|
}
|
|
5433
|
-
const M_ = "create-twenty-app", q_ = "0.2.
|
|
5437
|
+
const M_ = "create-twenty-app", q_ = "0.2.4", Ws = {
|
|
5434
5438
|
name: M_,
|
|
5435
5439
|
version: q_
|
|
5436
5440
|
}, Vs = new Fv(Ws.name).description("CLI tool to initialize a new Twenty application").version(
|
|
@@ -1,137 +1,29 @@
|
|
|
1
1
|
import js from '@eslint/js';
|
|
2
|
-
import
|
|
3
|
-
import typescriptParser from '@typescript-eslint/parser';
|
|
4
|
-
import importPlugin from 'eslint-plugin-import';
|
|
5
|
-
import preferArrowPlugin from 'eslint-plugin-prefer-arrow';
|
|
6
|
-
import prettierPlugin from 'eslint-plugin-prettier';
|
|
7
|
-
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
8
3
|
|
|
9
4
|
export default [
|
|
10
|
-
// Base JS rules
|
|
5
|
+
// Base JS recommended rules
|
|
11
6
|
js.configs.recommended,
|
|
12
7
|
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
ignores: ['**/node_modules/**', '**/dist/**', '**/coverage/**'],
|
|
16
|
-
},
|
|
8
|
+
// TypeScript recommended rules
|
|
9
|
+
...tseslint.configs.recommended,
|
|
17
10
|
|
|
18
|
-
// Base config for TS/JS files
|
|
19
11
|
{
|
|
20
|
-
files: ['**/*.
|
|
12
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
21
13
|
languageOptions: {
|
|
22
|
-
ecmaVersion: 'latest',
|
|
23
|
-
sourceType: 'module',
|
|
24
|
-
},
|
|
25
|
-
plugins: {
|
|
26
|
-
prettier: prettierPlugin,
|
|
27
|
-
import: importPlugin,
|
|
28
|
-
'prefer-arrow': preferArrowPlugin,
|
|
29
|
-
'unused-imports': unusedImportsPlugin,
|
|
30
|
-
},
|
|
31
|
-
rules: {
|
|
32
|
-
// General rules (aligned with main project)
|
|
33
|
-
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
34
|
-
'no-console': [
|
|
35
|
-
'warn',
|
|
36
|
-
{ allow: ['group', 'groupCollapsed', 'groupEnd'] },
|
|
37
|
-
],
|
|
38
|
-
'no-control-regex': 0,
|
|
39
|
-
'no-debugger': 'error',
|
|
40
|
-
'no-duplicate-imports': 'error',
|
|
41
|
-
'no-undef': 'off',
|
|
42
|
-
'no-unused-vars': 'off',
|
|
43
|
-
|
|
44
|
-
// Import rules
|
|
45
|
-
'import/no-relative-packages': 'error',
|
|
46
|
-
'import/no-useless-path-segments': 'error',
|
|
47
|
-
'import/no-duplicates': ['error', { considerQueryString: true }],
|
|
48
|
-
|
|
49
|
-
// Prefer arrow functions
|
|
50
|
-
'prefer-arrow/prefer-arrow-functions': [
|
|
51
|
-
'error',
|
|
52
|
-
{
|
|
53
|
-
disallowPrototype: true,
|
|
54
|
-
singleReturnOnly: false,
|
|
55
|
-
classPropertiesAllowed: false,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
|
|
59
|
-
// Unused imports
|
|
60
|
-
'unused-imports/no-unused-imports': 'warn',
|
|
61
|
-
'unused-imports/no-unused-vars': [
|
|
62
|
-
'warn',
|
|
63
|
-
{
|
|
64
|
-
vars: 'all',
|
|
65
|
-
varsIgnorePattern: '^_',
|
|
66
|
-
args: 'after-used',
|
|
67
|
-
argsIgnorePattern: '^_',
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
|
|
71
|
-
// Prettier (formatting as lint errors if you want)
|
|
72
|
-
'prettier/prettier': 'error',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
// TypeScript-specific configuration
|
|
77
|
-
{
|
|
78
|
-
files: ['**/*.{ts,tsx}'],
|
|
79
|
-
languageOptions: {
|
|
80
|
-
parser: typescriptParser,
|
|
81
14
|
parserOptions: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
15
|
+
project: true,
|
|
16
|
+
tsconfigRootDir: import.meta.dirname,
|
|
85
17
|
},
|
|
86
18
|
},
|
|
87
|
-
plugins: {
|
|
88
|
-
'@typescript-eslint': typescriptEslint,
|
|
89
|
-
},
|
|
90
19
|
rules: {
|
|
91
|
-
//
|
|
92
|
-
'no-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
'@typescript-eslint/ban-ts-comment': 'error',
|
|
96
|
-
'@typescript-eslint/consistent-type-imports': [
|
|
97
|
-
'error',
|
|
98
|
-
{
|
|
99
|
-
prefer: 'type-imports',
|
|
100
|
-
fixStyle: 'inline-type-imports',
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
104
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
105
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
106
|
-
'@typescript-eslint/no-empty-interface': [
|
|
107
|
-
'error',
|
|
108
|
-
{
|
|
109
|
-
allowSingleExtends: true,
|
|
110
|
-
},
|
|
20
|
+
// Common TypeScript-friendly tweaks
|
|
21
|
+
'@typescript-eslint/no-unused-vars': [
|
|
22
|
+
'warn',
|
|
23
|
+
{ argsIgnorePattern: '^_' },
|
|
111
24
|
],
|
|
112
25
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
113
|
-
'
|
|
114
|
-
'@typescript-eslint/no-unused-vars': 'off',
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
// Test files (Jest)
|
|
119
|
-
{
|
|
120
|
-
files: ['**/*.spec.@(ts|tsx|js|jsx)', '**/*.test.@(ts|tsx|js|jsx)'],
|
|
121
|
-
languageOptions: {
|
|
122
|
-
globals: {
|
|
123
|
-
jest: true,
|
|
124
|
-
describe: true,
|
|
125
|
-
it: true,
|
|
126
|
-
expect: true,
|
|
127
|
-
beforeEach: true,
|
|
128
|
-
afterEach: true,
|
|
129
|
-
beforeAll: true,
|
|
130
|
-
afterAll: true,
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
rules: {
|
|
134
|
-
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
26
|
+
'no-unused-vars': 'off', // handled by TS rule
|
|
135
27
|
},
|
|
136
28
|
},
|
|
137
29
|
];
|