Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix v2 release #294

Merged
merged 19 commits into from
Sep 13, 2024
735 changes: 165 additions & 570 deletions base.js

Large diffs are not rendered by default.

13 changes: 4 additions & 9 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import eslint from '@eslint/js';
import base from './index.js';

export default [
eslint.configs.recommended,
...base,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...eslint.configs.recommended.globals,
node: true,
},
rules: {
'no-magic-numbers': 'off',
},
},
];
21 changes: 18 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import jsonPlugin from 'eslint-plugin-json';
import securityPlugin from 'eslint-plugin-security';
import sonarjsPlugin from 'eslint-plugin-sonarjs';

import base from './base.js';
import jest from './jest.js';
import node from './node.js';
import prettier from './prettier.js';
import typescript from './ts.js';
import node from './node.js';
import jest from './jest.js';

export default [
...base,
...typescript,
...node,
...jest,
...prettier, // Should be last
jsonPlugin.configs.recommended,
securityPlugin.configs.recommended,
sonarjsPlugin.configs.recommended,
...prettier,

{
rules: {
'sort-imports': 'off',
'sort-keys': 'off',
'unicorn/no-null': 'off',
},
},
];
52 changes: 30 additions & 22 deletions jest.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,53 @@
import jestPlugin from 'eslint-plugin-jest';

const jestPluginConfig = jestPlugin.configs['flat/all'];
const TEST_FILE_GLOBS = [
'**/test/**',
'**/tests/**',
'**/spec/**',
'**/__tests__/**',
'*.test.*',
'*.spec.*',
'*.e2e.*',
'*.e2e-spec.*',
];

export default [
{
...jestPluginConfig,
...jestPlugin.configs['flat/all'],
files: TEST_FILE_GLOBS,
},

files: ['**/__tests__/**', '*.test.*', '*.spec.*'],
{
files: TEST_FILE_GLOBS,

rules: {
...jestPluginConfig.rules,
'jest/valid-expect': ['error', { alwaysAwait: true }],
'jest/max-expects': ['error', { max: 10 }],
'jest/no-restricted-matchers': [
'no-shadow': [
'error',
{
toMatchSnapshot: 'Use more targeted assertions instead of a snapshot',
toMatchInlineSnapshot:
'Use more targeted assertions instead of a snapshot',
toThrowErrorMatchingSnapshot:
'Use more targeted assertions instead of a snapshot',
toThrowErrorMatchingInlineSnapshot:
'Use more targeted assertions instead of a snapshot',

toBeTruthy:
'Use more explicit matchers like `.toBe(true)` or `.toBeGreaterThan(0)`. See https://docs.gitlab.com/ee/development/testing_guide/frontend_testing.html#avoid-using-tobetruthy-or-tobefalsy',
toBeFalsy:
'Use more explicit matchers like `.toBe(false)`, `.toBe(0)`, or `.toBeUndefined()`. See https://docs.gitlab.com/ee/development/testing_guide/frontend_testing.html#avoid-using-tobetruthy-or-tobefalsy',
toBeDefined:
'Use a more explicit matcher. See https://docs.gitlab.com/ee/development/testing_guide/frontend_testing.html#tricky-tobedefined-matcher',
allow: [
'defaultStatus',
'event',
'find',
'length',
'name',
'status',
'screen',
],
builtinGlobals: true,
},
],

'max-classes-per-file': 'off',
'no-magic-numbers': 'off',
},
},

{
files: ['jest.config.js', 'jest.config.cjs'],

languageOptions: {
sourceType: 'script',
project: null,
sourceType: 'script',
},

rules: {
Expand Down
15 changes: 0 additions & 15 deletions jestRules.js

This file was deleted.

2 changes: 1 addition & 1 deletion jsdoc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export default {
'jsdoc/check-tag-names': ['error', { definedTags: ['category', 'group'] }],
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param': 'off',
'jsdoc/require-param-type': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/check-tag-names': ['error', { definedTags: ['category', 'group'] }],
};
66 changes: 33 additions & 33 deletions node.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import eslintJsPlugin from '@eslint/js';
import nodePlugin from 'eslint-plugin-n';
import jsdoc from 'eslint-plugin-jsdoc';
import nodePlugin from 'eslint-plugin-n';
import sortClassMembersPlugin from 'eslint-plugin-sort-class-members';

export default [
Expand All @@ -11,27 +11,27 @@ export default [
nodePlugin.configs['flat/recommended-module'],
{
rules: {
'n/no-callback-literal': 'error',
'n/callback-return': 'error',
'n/exports-style': 'error',
'n/file-extension-in-import': 'error',
'n/prefer-global/buffer': 'error',
'n/prefer-global/console': 'error',
'n/prefer-global/process': 'error',
'n/prefer-global/text-decoder': 'error',
'n/prefer-global/text-encoder': 'error',
'n/prefer-global/url-search-params': 'error',
'n/prefer-global/url': 'error',
'n/prefer-promises/dns': 'error',
'n/prefer-promises/fs': 'error',
'n/callback-return': 'error',
'n/global-require': 'error',
'n/handle-callback-err': ['error', '^.*(e|E)rror'],
'n/no-callback-literal': 'error',
'n/no-mixed-requires': 'error',
'n/no-new-require': 'error',
'n/no-path-concat': 'error',
'n/no-process-env': 'error',
'n/no-process-exit': 'error',
'n/no-sync': 'error',
'n/prefer-global/buffer': 'error',
'n/prefer-global/console': 'error',
'n/prefer-global/process': 'error',
'n/prefer-global/text-decoder': 'error',
'n/prefer-global/text-encoder': 'error',
'n/prefer-global/url': 'error',
'n/prefer-global/url-search-params': 'error',
'n/prefer-promises/dns': 'error',
'n/prefer-promises/fs': 'error',
},
},

Expand All @@ -41,52 +41,53 @@ export default [
'sort-class-members/sort-class-members': [
'error',
{
accessorPairPositioning: 'getThenSet',
groups: {
'static-arrow-function-properties': [
'async-conventional-private-methods': [
{
static: true,
propertyType: 'ArrowFunctionExpression',
async: true,
name: '/_.+/',
type: 'method',
},
],
'static-async-methods': [
'static-accessor-pairs': [{ accessorPair: true, static: true }],
'static-arrow-function-properties': [
{
propertyType: 'ArrowFunctionExpression',
static: true,
type: 'method',
async: true,
},
],
'static-accessor-pairs': [{ static: true, accessorPair: true }],
'static-getters': [{ static: true, kind: 'get' }],
'static-setters': [{ static: true, kind: 'set' }],
'static-conventional-private-properties': [
'static-async-conventional-private-methods': [
{
static: true,
type: 'property',
async: true,
name: '/_.+/',
static: true,
type: 'method',
},
],
'static-conventional-private-methods': [
'static-async-methods': [
{
async: true,
static: true,
type: 'method',
name: '/_.+/',
},
],
'static-async-conventional-private-methods': [
'static-conventional-private-methods': [
{
name: '/_.+/',
static: true,
type: 'method',
name: '/_.+/',
async: true,
},
],
'async-conventional-private-methods': [
'static-conventional-private-properties': [
{
type: 'method',
name: '/_.+/',
async: true,
static: true,
type: 'property',
},
],
'static-getters': [{ kind: 'get', static: true }],
'static-setters': [{ kind: 'set', static: true }],
},
order: [
'[static-properties]',
Expand All @@ -111,7 +112,6 @@ export default [
'[conventional-private-methods]',
'[async-conventional-private-methods]',
],
accessorPairPositioning: 'getThenSet',
},
],
},
Expand Down
Loading
Loading