Skip to content

Commit

Permalink
Merge pull request #25 from 3fs/v2
Browse files Browse the repository at this point in the history
Remove configs and improve the pipeline
  • Loading branch information
zvan authored Oct 9, 2023
2 parents 92599ff + 2d18138 commit fdf5ed6
Show file tree
Hide file tree
Showing 27 changed files with 20,688 additions and 1,535 deletions.
296 changes: 290 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,294 @@
const defaultRules = require('./configs/defaults').rules;
const env = require('./configs/node-es5').env;

module.exports = {
env: env,
env: { node: true },
plugins: ['prettier'],
extends: ['prettier'],
rules: {
...defaultRules,
'quote-props': ['error', 'consistent'],
'accessor-pairs': 'error',
'array-bracket-spacing': 'off',
'array-callback-return': 'error',
'arrow-body-style': ['error', 'as-needed'],
'block-scoped-var': 'error',
'capitalized-comments': 'off',
'class-methods-use-this': 'off',
complexity: 'off',
'consistent-return': 'off',
'consistent-this': ['error', 'that', 'self'],
camelcase: ['error'],
'constructor-super': 'error',
'dot-notation': 'error',
eqeqeq: ['error', 'always', { null: 'ignore' }],
'default-case': 'error',
'default-case-last': 'error',
'default-param-last': 'error',
'func-name-matching': 'off',
'func-names': 'off',
'func-style': 'off',
'function-call-argument-newline': 'off',
'for-direction': 'error',
'guard-for-in': 'off',
'getter-return': 'error',
'grouped-accessor-pairs': 'off',
'id-denylist': 'off',
'id-length': 'off',
'id-match': 'off',
'init-declarations': 'off',
'jsx-quotes': 'off',
'line-comment-position': ['off', { position: 'above' }],
'linebreak-style': 'off',
'lines-around-comment': 'off',
'lines-between-class-members': ['error', 'always'],
'max-classes-per-file': ['error', 1],
'max-depth': ['error', 4],
'max-len': [
'error',
170,
4,
{
ignoreComments: true,
ignoreUrls: true,
ignorePattern: '^\\s*var\\s.+=\\s*require\\s*\\(',
},
],
'max-lines': 'off',
'max-lines-per-function': [
'warn',
{
max: 100,
skipComments: true,
skipBlankLines: true,
},
],
'max-nested-callbacks': ['error', 3],
'max-params': ['error', 5],
'max-statements': ['warn', 20, { ignoreTopLevelFunctions: true }],
'multiline-comment-style': ['error', 'starred-block'],
'multiline-ternary': 'off',
'no-alert': 'error',
'no-async-promise-executor': 'error',
'no-await-in-loop': 'error',
'no-bitwise': 'error',
'no-case-declarations': 'off',
'no-confusing-arrow': 'off',
'no-console': 'error',
'no-constructor-return': 'error',
'no-continue': 'off',
'no-div-regex': 'off',
'no-duplicate-imports': 'error',
'no-dupe-else-if': 'error',
'no-else-return': 'off',
'no-empty': 'error',
'no-empty-function': ['error', { allow: ['arrowFunctions'] }],
'no-eq-null': 'error',
'no-extra-label': 'off',
'no-implicit-coercion': 'error',
'no-implicit-globals': 'error',
'no-import-assign': 'error',
'no-inline-comments': 'off',
'no-invalid-this': 'off',
'no-lonely-if': 'error',
'no-loop-func': 'error',
'no-loss-of-precision': 'error',
'no-magic-numbers': 'off',
'no-misleading-character-class': 'off',
'no-multi-assign': 'off',
'no-negated-condition': 'error',
'no-nested-ternary': 'error',
'no-nonoctal-decimal-escape': 'error',
'no-param-reassign': 'error',
'no-plusplus': 'off',
'no-prototype-builtins': 'off',
'no-restricted-exports': 'off',
'no-restricted-globals': 'off',
'no-restricted-imports': 'off',
'no-restricted-properties': 'off',
'no-restricted-syntax': 'off',
'no-setter-return': 'error',
'no-script-url': 'error',
'no-shadow': 'error',
'no-ternary': 'off',
'no-undefined': 'off',
'no-underscore-dangle': 'error',
'no-unused-labels': 'error',
'no-useless-concat': 'error',
'no-var': 'off',
'no-void': 'off',
'no-warning-comments': 'off',
'nonblock-statement-body-position': 'off',
'new-cap': ['error', { newIsCap: true, capIsNew: false }],
'no-array-constructor': 'error',
'no-caller': 'error',
'no-class-assign': 'error',
'no-compare-neg-zero': 'error',
'no-cond-assign': 'error',
'no-const-assign': 'error',
'no-constant-condition': ['error', { checkLoops: false }],
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-class-members': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty-character-class': 'error',
'no-empty-pattern': 'error',
'no-eval': 'error',
'no-ex-assign': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-global-assign': 'error',
'no-implied-eval': 'error',
'no-inner-declarations': ['error', 'functions'],
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-iterator': 'error',
'no-label-var': 'error',
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
'no-lone-blocks': 'error',
'no-mixed-operators': [
'error',
{
groups: [
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
allowSamePrecedence: true,
},
],
'no-multi-str': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-symbol': 'error',
'no-new-wrappers': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-promise-executor-return': 'error',
'no-proto': 'error',
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-return-assign': ['error', 'except-parens'],
'no-return-await': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-shadow-restricted-names': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-this-before-super': 'error',
'no-throw-literal': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-unexpected-multiline': 'error',
'no-unmodified-loop-condition': 'error',
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
'no-unreachable': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unsafe-optional-chaining': 'error',
'no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
'no-unused-vars': [
'error',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: true,
},
],
'no-use-before-define': [
'error',
{
functions: false,
classes: false,
variables: false,
},
],
'no-useless-backreference': 'error',
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-computed-key': 'error',
'no-useless-constructor': 'error',
'no-useless-escape': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-with': 'error',
'one-var': ['error', 'always'],

'prefer-object-spread': 'error',
'prefer-promise-reject-errors': 'error',
'object-shorthand': ['error', 'always'],
'one-var-declaration-per-line': 'off',
'operator-assignment': ['error', 'always'],
'prefer-arrow-callback': 'off',
'prefer-const': 'off',
'prefer-destructuring': 'off',
'prefer-exponentiation-operator': 'off',
'prefer-named-capture-group': 'off',
'prefer-numeric-literals': 'off',
'prefer-regex-literals': 'off',
'prefer-rest-params': 'off',
'prefer-spread': 'off',
'prefer-template': 'off',
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: ['const', 'let', 'var'],
next: '*',
},
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
{
blankLine: 'always',
prev: '*',
next: 'return',
},
],
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
radix: ['error', 'as-needed'],
'require-atomic-updates': 'error',
'require-await': 'error',
'require-unicode-regexp': 'error',
'require-yield': 'error',
'sort-imports': 'off',
'sort-keys': 'off',
'sort-vars': 'off',
strict: ['error', 'function'],
'spaced-comment': [
'error',
'always',
{
line: {
markers: ['*package', '!', '/', ','],
},
block: {
balanced: true,
markers: ['*package', '!', ',', ':', '::', 'flow-include'],
exceptions: ['*'],
},
},
],
'symbol-description': 'error',
'unicode-bom': ['error', 'never'],
'use-isnan': 'error',
'vars-on-top': 'error',
'valid-typeof': ['error', { requireStringLiterals: true }],
'wrap-regex': 'off',
yoda: ['error', 'never'],
},
};
77 changes: 77 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test

on: push
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: yarn install
- run: yarn prettier:lint

eslint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: yarn install
- run: yarn eslint:lint

angular:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: yarn install
- run: TEST_CONFIG=angular TEST_FILE=index.ts yarn eslint:printRules
- run: TEST_CONFIG=angular TEST_FILE=index.spec.ts yarn eslint:printRules
- run: TEST_CONFIG=angular TEST_FILE=index.model.spec.ts yarn eslint:printRules
- run: TEST_CONFIG=angular TEST_FILE=index.model.ts yarn eslint:printRules
- run: TEST_CONFIG=angular TEST_FILE=index.abstract.ts yarn eslint:printRules
- run: TEST_CONFIG=angular TEST_FILE=index.html yarn eslint:printRules
- run: |
if [ "$(git status --porcelain)" != "" ]; then
echo "Some rules have changed"
exit 1
else
echo "No changes detected in snapshots"
fi
react:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- run: yarn install
- run: TEST_CONFIG=react-ts TEST_FILE=index.ts yarn eslint:printRules
- run: TEST_CONFIG=react-ts TEST_FILE=src/Mocks/Data/index.ts yarn eslint:printRules
- run: TEST_CONFIG=react-ts TEST_FILE=index.spec.ts yarn eslint:printRules
- run: TEST_CONFIG=react-ts TEST_FILE=src/Generated/index.ts yarn eslint:printRules
- run: |
if [ "$(git status --porcelain)" != "" ]; then
echo "Some rules have changed"
exit 1
else
echo "No changes detected in snapshots"
fi
10 changes: 10 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
useTabs: false,
tabWidth: 2,
singleQuote: true,
printWidth: 100,
semi: true,
bracketSpacing: true,
trailingComma: 'all',
endOfLine: 'lf',
};
Loading

0 comments on commit fdf5ed6

Please sign in to comment.