diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 823906c..0000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -/node_modules/ -/tests/fixtures/ diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 1cf4200..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "." -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..4382a68 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,3 @@ +import configs from './index.js' + +export default [...configs, {ignores: ['tests/fixtures/*']}] diff --git a/index.js b/index.js index 1759360..f6b56c6 100644 --- a/index.js +++ b/index.js @@ -1,654 +1,20 @@ -const confusingBrowserGlobals = require('confusing-browser-globals') - -module.exports = { - extends: ['eslint:recommended', 'plugin:import/typescript', 'prettier'], - plugins: ['import', 'react', 'jsx-a11y', 'react-hooks', 'jsdoc'], - parserOptions: { - sourceType: 'module', - ecmaFeatures: { - jsx: true, - }, - }, - env: { - browser: true, - es2024: true, - node: true, - }, - rules: { - // https://github.com/prettier/eslint-config-prettier#arrow-body-style-and-prefer-arrow-callback - 'arrow-body-style': [2, 'as-needed', {requireReturnForObjectLiteral: false}], - - // disallow uncommon syntax that is hard to use correctly - 'no-restricted-syntax': [2, 'ForInStatement', 'LabeledStatement', 'WithStatement'], - - // ensure that default, named, and namespaced imports have been exported by the target file - 'import/default': [2], - 'import/named': [2], - 'import/namespace': [2, {allowComputed: true}], - - // allow extensionless imports of TS files - 'import/extensions': [ - 2, - 'ignorePackages', - {ts: 'never', tsx: 'never', js: 'never', jsx: 'never', mjs: 'never'}, - ], - - // allow imports of dev dependencies from tests and sandboxes - 'import/no-extraneous-dependencies': [ - 2, - { - devDependencies: [ - 'test/**', - 'tests/**', - 'sandbox/**', - 'spec/**', - '**/__integration__/**', - '**/__integration_tests__/**', - '**/__tests__/**', - '**/__mocks__/**', - 'test.{js,jsx,ts,tsx}', - 'test-*.{js,jsx,ts,tsx}', - '**/*{.,_}{test,spec}.{js,jsx,ts,tsx}', - '**/jest{.,-,_}*.{js,jsx,ts,tsx}', - '**/*.config.{js,jsx,ts,tsx}', - '**/*.config.*.{js,jsx,ts,tsx}', - ], - optionalDependencies: false, - }, - ], - - // require import groups to be ordered by specificity and separated by linebreaks - 'import/order': [2, {'newlines-between': 'always'}], - - // require well-formatted JSDoc comments, when they exist - 'jsdoc/check-alignment': [2], - 'jsdoc/check-indentation': [2], - 'jsdoc/check-param-names': [2], - 'jsdoc/check-tag-names': [2, {definedTags: ['jest-environment']}], - 'jsdoc/require-hyphen-before-param-description': [2, 'never'], - 'jsdoc/require-description': [2], - 'jsdoc/require-param-description': [2], - 'jsdoc/require-param-name': [2], - 'jsdoc/require-returns-description': [2], - 'jsdoc/tag-lines': [2, 'never', {startLines: 1}], - - // allow non-ID-linked