0.1.1 • Published 11 months ago
@paulaschoice/eslint v0.1.1
@paulaschoice/eslint-config
Collection of internal eslint configurations.
Example Usage
Only use this for reference, do not copy line for line. Refer to eslint docs for more information.
React Project
import globals from 'globals';
import createBaseConfig from '@paulaschoice/eslint/base.mjs';
import reactConfig from '@paulaschoice/eslint/react.mjs';
import reactHooksPlugin from 'eslint-plugin-react-hooks';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const dir = path.resolve(__dirname);
const baseConfig = createBaseConfig(dir);
/** @type {import('typescript-eslint').Config} */
export default [
...baseConfig,
...reactConfig,
{
languageOptions: {
globals: {
...globals.browser,
},
},
// Duplicate plugin added here to allow exhaustive-deps to be added.
plugins: { 'react-hooks': reactHooksPlugin },
rules: {
'react-hooks/exhaustive-deps': [
'error',
{
additionalHooks:
'(usePageChange|useCustomerChange|useBagChange|useScrolledInToView|useListener|useResizeObserver|useDocumentEventListener|useEmailSignUp)',
},
],
},
},
];TS project
import createBaseConfig from '@paulaschoice/eslint/base.mjs';
import path from 'node:path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const baseConfig = createBaseConfig(__dirname);
/** @type {import('typescript-eslint').Config} */
export default [
...baseConfig,
{
languageOptions: {
globals: {
require: 'readonly',
module: 'readonly',
exports: 'readonly',
},
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
{ ignores: ['data/**/*'] },
];0.1.1
11 months ago