Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
valya committed Sep 4, 2024
0 parents commit 7994502
Show file tree
Hide file tree
Showing 12 changed files with 6,250 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true

[*]
charset = utf-8
indent_style = tab
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[package.json]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2

[*.ts]
quote_type = single
131 changes: 131 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/**
* @type {import('@types/eslint').ESLint.ConfigData}
*/
module.exports = {
parser: '@typescript-eslint/parser',

parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},

ignorePatterns: ['node_modules/**', 'dist/**', '*.js'],

plugins: [
'@typescript-eslint',
'eslint-plugin-prettier',
'eslint-plugin-import',
'unused-imports',
'eslint-plugin-unicorn',
],

extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'eslint-config-airbnb-typescript/base',
'eslint-config-prettier',
],

rules: {
// eslint

'arrow-body-style': 'off',
'class-methods-use-this': 'off',
'no-plusplus': 'off',
'no-unused-vars': 'off',
'no-void': ['error', { allowAsStatement: true }],
'object-shorthand': 'error',
'prefer-arrow-callback': 'off',
'prefer-const': 'error',
'prefer-spread': 'error',
eqeqeq: 'error',

// import

'import/no-cycle': 'error',
'import/no-default-export': 'error',
'import/order': 'error',

// @typescript-eslint

'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-duplicate-imports': 'error',
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
'@typescript-eslint/no-invalid-void-type': 'error',
'@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-throw-literal': 'error',
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/triple-slash-reference': 'off',
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],

'@typescript-eslint/no-unused-vars': [
process.env.CI_LINT_MASTER ? 'warn' : 'error',
{
argsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
varsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'no-restricted-syntax': [
'error',
{
selector: 'TSEnumDeclaration:not([const=true])',
message:
'Do not declare raw enums as it leads to runtime overhead. Use const enum instead. See https://www.typescriptlang.org/docs/handbook/enums.html#const-enums',
},
],

// prettier

'prettier/prettier': ['error', { endOfLine: 'auto' }],

// unused imports

'unused-imports/no-unused-imports': process.env.NODE_ENV === 'development' ? 'warn' : 'error',

// unicorn

'unicorn/no-unnecessary-await': 'error',
'unicorn/no-useless-promise-resolve-reject': 'error',

// ===============
// disabled
// ===============

'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-duplicate-imports': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-implied-eval': 'off',
'@typescript-eslint/no-loop-func': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
indent: 'off',
'import/extensions': 'off',
'sort-imports': 'off',
},
};
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
node_modules
.DS_Store
.tmp
tmp
dist
coverage
npm-debug.log*
yarn.lock
google-generated-credentials.json
_START_PACKAGE
.env
.vscode/*
!.vscode/extensions.json
!.vscode/settings.default.json
.idea
nodelinter.config.json
**/package-lock.json
packages/**/.turbo
.turbo
*.tsbuildinfo
*.swp
CHANGELOG-*.md
*.mdx
build-storybook.log
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage
dist
package.json
.pnpm-lock.yml
51 changes: 51 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module.exports = {
/**
* https://prettier.io/docs/en/options.html#semicolons
*/
semi: true,

/**
* https://prettier.io/docs/en/options.html#trailing-commas
*/
trailingComma: 'all',

/**
* https://prettier.io/docs/en/options.html#bracket-spacing
*/
bracketSpacing: true,

/**
* https://prettier.io/docs/en/options.html#tabs
*/
useTabs: true,

/**
* https://prettier.io/docs/en/options.html#tab-width
*/
tabWidth: 2,

/**
* https://prettier.io/docs/en/options.html#arrow-function-parentheses
*/
arrowParens: 'always',

/**
* https://prettier.io/docs/en/options.html#quotes
*/
singleQuote: true,

/**
* https://prettier.io/docs/en/options.html#quote-props
*/
quoteProps: 'as-needed',

/**
* https://prettier.io/docs/en/options.html#end-of-line
*/
endOfLine: 'lf',

/**
* https://prettier.io/docs/en/options.html#print-width
*/
printWidth: 100,
};
35 changes: 35 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const { compilerOptions } = require('./tsconfig.json');

const tsJestOptions = {
isolatedModules: true,
tsconfig: {
...compilerOptions,
declaration: false,
sourceMap: true,
skipLibCheck: true,
},
};

/** @type {import('jest').Config} */
const config = {
verbose: true,
testEnvironment: 'node',
testRegex: '\\.(test|spec)\\.(js|ts)$',
testPathIgnorePatterns: ['/dist/', '/node_modules/'],
transform: {
'^.+\\.ts$': ['ts-jest', tsJestOptions],
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
collectCoverage: true,
coverageReporters: [process.env.COVERAGE_REPORT === 'true' ? 'text' : 'text-summary'],
collectCoverageFrom: ['src/**/*.ts'],
};

if (process.env.CI === 'true') {
config.workerIdleMemoryLimit = 1024;
config.coverageReporters = ['cobertura'];
}

module.exports = config;
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "@n8n/agent",
"version": "0.1.0",
"description": "",
"main": "dist/index.js",
"scripts": {
"start": "ts-node src/index.ts",
"build": "tsc -p ./tsconfig.build.json",
"test": "jest",
"lint": "eslint .",
"lintfix": "eslint . --fix"
},
"engines": {
"node": ">=20.15",
"pnpm": ">=9.5"
},
"files": [
"src/",
"dist/",
"LICENSE.md",
"package.json",
"tsconfig.json"
],
"packageManager": "[email protected]",
"keywords": [],
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@n8n_io/eslint-config": "^0.0.2",
"@types/jest": "^29.5.0",
"@types/node": "^18.13.0",
"@types/ws": "^8.5.12",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"eslint": "^8.38.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-n8n-local-rules": "^1.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-unicorn": "^48.0.0",
"eslint-plugin-unused-imports": "^3.0.0",
"jest": "^29.5.0",
"nodemon": "^2.0.20",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.7",
"typescript": "^5.0.0"
},
"dependencies": {
"jmespath": "^0.16.0",
"luxon": "^3.5.0",
"n8n-workflow": "^1.48.0",
"nanoid": "^3.3.6",
"ws": "^8.18.0"
}
}
Loading

0 comments on commit 7994502

Please sign in to comment.