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

Upgrade to ESLint 9 #20

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

1 change: 0 additions & 1 deletion .eslintrc.js

This file was deleted.

4 changes: 3 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
module.exports = require('./src/prettier.config');
import baseConfig from './src/prettier.config.js';

export default baseConfig;
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,28 @@ commit:

## Configure ESLint

To configure [ESLint](https://eslint.org/), add the following to your
`package.json` file. This will allow ESLint to discover the configuration this
repository provides from within your `node_modules` folder, and will check
your `*.js`, `*.ts`, and `*.tsx` files for infractions every time you create a
new commit:
To configure [ESLint](https://eslint.org/), import our flat config and add it
to your `eslint.config.js` file:

```js
import baseConfig from '@actinc/eslint-config';

export default [
...baseConfig,
{
// Your project customizations go here.
},
];
```

To check your `.js(x)` and `.ts(x)` files for infractions every time you create
a new commit, you can add the following to your `package.json` file:

```json
...
"eslintConfig": {
...
"extends": [
...
"@actinc/eslint-config",
...
],
...
},
...
"lint-staged": {
...
"*.{js,ts,tsx}": "eslint",
"*.{js,jsx,ts,tsx}": "npx eslint",
...
},
...
Expand Down
8 changes: 8 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import baseConfig from './src/index.js';

export default [
...baseConfig,
{
ignores: ['dist'],
},
];
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
// eslint-disable-next-line import/no-extraneous-dependencies

Check failure on line 1 in examples/ReactComponent/index.tsx

View workflow job for this annotation

GitHub Actions / Test

Definition for rule 'import/no-extraneous-dependencies' was not found

import React from 'react';

const ReactComponent: React.FC = () => {
const [index, setIndex] = React.useState(0);

// eslint-disable-next-line lodash/prefer-constant
const fn = (): boolean => true;

return (
<button
onClick={(): void => {
setIndex(index + 1);
fn();
}}
type="button"
>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable filenames/match-exported */

Check failure on line 1 in jest.config.ts

View workflow job for this annotation

GitHub Actions / Test

Definition for rule 'filenames/match-exported' was not found

import { JestConfigWithTsJest } from 'ts-jest';

const config: JestConfigWithTsJest = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
preset: 'ts-jest',
roots: ['<rootDir>/test'],
roots: ['<rootDir>/examples'],
setupFilesAfterEnv: ['./jest.setup.ts'],
testEnvironment: 'jsdom',
transform: {
Expand Down
Loading
Loading