Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion demo/src/AutoAlignment.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'

import Stick from '../../es'

function AutoAlignment() {
Expand Down
1 change: 0 additions & 1 deletion demo/src/Demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'

import AutoAlignment from './AutoAlignment'
import PositionAlignOverview from './PositionAlignOverview'
import Regressions from './regressions'
Expand Down
1 change: 0 additions & 1 deletion demo/src/regressions/ButtonOverlay.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'

import Stick from '../../../es'
import Regression from './Regression'

Expand Down
1 change: 0 additions & 1 deletion demo/src/regressions/Regressions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'

import ButtonOverlay from './ButtonOverlay'
import FitOnPage from './FitOnPage'
import SameWidth from './SameWidth'
Expand Down
1 change: 0 additions & 1 deletion demo/src/regressions/StickInSvg.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react'

import Stick from '../../../es'
import Regression from './Regression'

Expand Down
174 changes: 174 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
import js from '@eslint/js'
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'
import tseslint from 'typescript-eslint'
import reactPlugin from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import importPlugin from 'eslint-plugin-import'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import globals from 'globals'

export default tseslint.config(
// Global ignores
{
ignores: ['lib/**', 'es/**', 'build/**', 'tests/coverage/**'],
},

// Base JS recommended rules
js.configs.recommended,

// TypeScript recommended rules (no type-aware)
...tseslint.configs.recommended,

// React (wrapped for ESLint 10 compat — plugin uses removed context methods)
...fixupConfigRules(reactPlugin.configs.flat.recommended),
...fixupConfigRules(reactPlugin.configs.flat['jsx-runtime']),

// React Hooks
reactHooks.configs['recommended-latest'],

// Main config block for TS/TSX files
{
files: ['**/*.{ts,tsx}'],

plugins: {
'jsx-a11y': fixupPluginRules(jsxA11y),
import: fixupPluginRules(importPlugin),
},

languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
},
parserOptions: {
ecmaFeatures: { jsx: true },
},
},

settings: {
react: { version: 'detect' },
},

rules: {
// Core rules (carried from eslint-config-react-app)
'array-callback-return': 'warn',
eqeqeq: ['warn', 'smart'],
'no-caller': 'warn',
'no-eval': 'warn',
'no-extend-native': 'warn',
'no-extra-bind': 'warn',
'no-extra-label': 'warn',
'no-implied-eval': 'warn',
'no-iterator': 'warn',
'no-label-var': 'warn',
'no-labels': ['warn', { allowLoop: true, allowSwitch: false }],
'no-lone-blocks': 'warn',
'no-loop-func': 'warn',
'no-multi-str': 'warn',
'no-new-func': 'warn',
'no-new-wrappers': 'warn',
'no-octal-escape': 'warn',
'no-restricted-syntax': ['warn', 'WithStatement'],
'no-script-url': 'warn',
'no-self-compare': 'warn',
'no-sequences': 'warn',
'no-template-curly-in-string': 'warn',
'no-throw-literal': 'warn',
'no-useless-computed-key': 'warn',
'no-useless-concat': 'warn',
'no-useless-rename': 'warn',
strict: ['warn', 'never'],

// TypeScript handles these better
'no-undef': 'off',
'no-redeclare': 'off',
'no-use-before-define': 'off',
'no-unused-expressions': 'off',
'no-unused-vars': 'off',
'no-useless-constructor': 'off',
'no-array-constructor': 'off',

// TypeScript-ESLint rules (carried from react-app)
'@typescript-eslint/consistent-type-assertions': 'warn',
'@typescript-eslint/no-array-constructor': 'warn',
'@typescript-eslint/no-redeclare': 'warn',
'@typescript-eslint/no-use-before-define': [
'warn',
{
functions: false,
classes: false,
variables: false,
typedefs: false,
},
],
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
'@typescript-eslint/no-unused-vars': [
'warn',
{ args: 'none', ignoreRestSiblings: true, varsIgnorePattern: '^React$' },
],
'@typescript-eslint/no-useless-constructor': 'warn',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-require-imports': 'off',

// Import rules (carried from react-app)
'import/first': 'error',
'import/no-amd': 'error',
'import/no-anonymous-default-export': 'warn',

// React rules
'react/jsx-pascal-case': ['warn', { allowAllCaps: true }],
'react/no-typos': 'error',
'react/style-prop-object': 'warn',
'react/prop-types': 'off',
'react/display-name': 'off',
'react/no-unescaped-entities': 'off',

// jsx-a11y rules (carried from react-app)
'jsx-a11y/alt-text': 'warn',
'jsx-a11y/anchor-has-content': 'warn',
'jsx-a11y/anchor-is-valid': [
'warn',
{ aspects: ['noHref', 'invalidHref'] },
],
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/aria-proptypes': 'warn',
'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }],
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/heading-has-content': 'warn',
'jsx-a11y/iframe-has-title': 'warn',
'jsx-a11y/img-redundant-alt': 'warn',
'jsx-a11y/no-access-key': 'warn',
'jsx-a11y/no-distracting-elements': 'warn',
'jsx-a11y/no-redundant-roles': 'warn',
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/role-supports-aria-props': 'warn',
'jsx-a11y/scope': 'warn',
},
},

// Prettier — MUST be last
eslintPluginPrettierRecommended,
{
rules: {
'prettier/prettier': [
'error',
{
semi: false,
singleQuote: true,
trailingComma: 'es5',
},
],
},
}
)
Loading