@wppconnect/wa-js
Version:
WPPConnect/WA-JS is an open-source project with the aim of exporting functions from WhatsApp Web
124 lines (117 loc) • 3.89 kB
JavaScript
/*!
* Copyright 2022 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import eslint from '@eslint/js';
import headerPlugin from '@tony.ganchev/eslint-plugin-header';
import prettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import prettierPlugin from 'eslint-plugin-prettier';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import tseslint from 'typescript-eslint';
export default [
// Base recommended configs
eslint.configs.recommended,
...tseslint.configs.recommended,
prettier,
// Ignore patterns
{
ignores: ['webpack.config.js', 'dist/**/*', 'wa-source/**/*', 'docs/**/*'],
},
// Base config for all TypeScript files
{
files: ['**/*.ts', '**/*.tsx'],
plugins: {
'@typescript-eslint': tseslint.plugin,
'simple-import-sort': simpleImportSort,
import: importPlugin,
header: headerPlugin,
prettier: prettierPlugin,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
},
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'no-useless-assignment': 'off',
'header/header': [
'error',
'block',
[
'!',
{
pattern: '^ \\* Copyright \\d{4} WPPConnect Team$',
template: ' * Copyright 2022 WPPConnect Team',
},
' *',
' * Licensed under the Apache License, Version 2.0 (the "License");',
' * you may not use this file except in compliance with the License.',
' * You may obtain a copy of the License at',
' *',
' * http://www.apache.org/licenses/LICENSE-2.0',
' *',
' * Unless required by applicable law or agreed to in writing, software',
' * distributed under the License is distributed on an "AS IS" BASIS,',
' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
' * See the License for the specific language governing permissions and',
' * limitations under the License.',
' ',
],
],
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'prettier/prettier': 'error',
},
},
// Override for whatsapp directory
{
files: ['src/whatsapp/**/*.ts'],
rules: {
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
},
},
// CommonJS config files
{
files: ['**/*.cjs'],
languageOptions: {
globals: {
module: 'readonly',
require: 'readonly',
exports: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
},
},
},
];