Skip to content

Commit

Permalink
refactor!: es modules and commonjs build
Browse files Browse the repository at this point in the history
BREAKING CHANGE: changed file structure
  • Loading branch information
milosbugarinovic committed Jul 20, 2023
1 parent 6d6575a commit 098b331
Show file tree
Hide file tree
Showing 238 changed files with 20,568 additions and 27,064 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.idea
/!.idea/runConfigurations
/.base-frame-tmp
/coverage
/dist
/node_modules
/packages
/test/node_modules
/test/dist
*.tsbuildinfo
26 changes: 25 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
root = true

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

[*.md]
trim_trailing_whitespace = false

[{*.ts, *.js}]
ij_typescript_import_prefer_absolute_path = false
ij_visual_guides = 130
ij_javascript_force_semicolon_style = false
ij_typescript_import_prefer_absolute_path = true
ij_typescript_use_path_mapping = always
ij_typescript_force_semicolon_style = false
ij_typescript_force_quote_style = true
ij_typescript_enforce_trailing_comma = whenmultiline
ij_typescript_use_double_quotes = false
ij_typescript_use_semicolon_after_statement = false
ij_typescript_spaces_within_imports = true
23 changes: 14 additions & 9 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
.base-frame-tmp
.idea
.nyc_output
.semaphore
coverage
lib
node_modules
resource
unit.test.js
/.base-frame-tmp
/.idea
/.semaphore
/coverage
/dist
/node_modules
/resource
/packages
.*.js
.*.json
package-lock.json
tsconfig*.json
typedoc.json
/jest*.config.js
145 changes: 145 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
const namingConvention = () => {
// prettier-ignore
return [
{ selector: ['default'], format: null, modifiers: ['public'], leadingUnderscore: 'forbid' },
{ selector: ['default'], format: ['camelCase'], modifiers: ['protected'], leadingUnderscore: 'require' },
{ selector: ['default'], format: ['camelCase'], modifiers: ['private'], prefix: ['__'] },
{ selector: ['accessor'], format: ['camelCase'], modifiers: ['public'], leadingUnderscore: 'forbid' },
{ selector: ['accessor'], format: ['camelCase'], modifiers: ['protected'], leadingUnderscore: 'require' },
{ selector: ['accessor'], format: ['camelCase'], modifiers: ['private'], prefix: ['__'] },
{ selector: ['enum'], format: ['PascalCase'] },
{ selector: ['enumMember'], format: ['UPPER_CASE'] },
{ selector: ['classMethod', 'accessor'], format: ['PascalCase'], modifiers: ['public', 'static'] },
{ selector: ['classProperty'], format: ['UPPER_CASE'], modifiers: ['public', 'static'] },

]
}

module.exports = {
root: true,
env: {
es6: true,
'jest/globals': true,
node: true,
},
settings: {
'import/resolver': {
node: {
paths: ['./'],
},
},
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/strict',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'ESNext',
project: './tsconfig.eslint.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'eslint-plugin-import', 'import', 'no-only-tests', 'no-loops', 'jest', 'sort-keys-fix'],
rules: {
// TODO TEMP DISABLE
'@typescript-eslint/no-explicit-any':'warn',
// ESLINT
// 'no-restricted-imports': [
// 'error',
// {
// patterns: [
// {
// group: ['**/index'],
// message: 'Please use `.../something` instead of ``.../something/index`',
// },
// ],
// },
// ],

'prefer-arrow-callback': 'error',
'no-confusing-arrow': 'error',
'no-constant-condition': 'error',

'no-ternary': 'warn', // TODO temp warn, revert to error
'@typescript-eslint/no-var-requires': 'warn', // TODO temp warn, remove and use default value

'padding-line-between-statements': [
'error',
{ blankLine: 'always', next: 'return', prev: '*' },
{ blankLine: 'always', next: ['cjs-export', 'export'], prev: '*' },
],
'prefer-template': 'error',
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
},
],

// NO_LOOPS
'no-loops/no-loops': 'error',

// DISABLE STRICT
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
'@typescript-eslint/naming-convention': ['warn', ...namingConvention()], // TODO temp warn, revert to error

// TYPESCRIPT
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-expect-error': 'allow-with-description' }],
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_', varsIgnorePattern: '^_' },
],

// IMPORT
'import/namespace': [
'error',
{
allowComputed: true,
},
],
'import/newline-after-import': 'error',
'import/no-unresolved': 'off',
'import/order': [
'error',
{
alphabetize: {
caseInsensitive: false,
order: 'asc',
},
groups: [['index', 'sibling', 'parent', 'internal', 'external', 'builtin', 'object']],
'newlines-between': 'always',
},
],

// JEST
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
'no-console': 'error',
'no-duplicate-imports': 'error',

//NO_ONLY_TESTS
'no-only-tests/no-only-tests': 'error',

// SORT_KEYS_FIX
'sort-keys-fix/sort-keys-fix': ['error', 'asc', { caseSensitive: false, natural: true }],

// PRETTIER
'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
curly: 'error',
'no-mixed-spaces-and-tabs': 'error',
},
}
106 changes: 0 additions & 106 deletions .eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .git-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pull]
rebase = true
15 changes: 10 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.base-frame-tmp
.vscode
.nyc_output
coverage
node_modules
/.idea
/!.idea/runConfigurations
/.base-frame-tmp
/coverage
/dist
/node_modules
/packages
/test/node_modules
/test/dist
*.tsbuildinfo
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
npx lint-staged
3 changes: 3 additions & 0 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"reject": []
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.15.0
26 changes: 0 additions & 26 deletions .nycrc

This file was deleted.

16 changes: 7 additions & 9 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.base-frame-tmp
.idea/
.nyc_output/
.semaphore/
coverage/
lib/
node_modules/
resource/
package.json
/.idea
/.semaphore
/coverage
/dist
/node_modules
/resource
/packages
package-lock.json
Loading

0 comments on commit 098b331

Please sign in to comment.