Skip to content

Commit

Permalink
chore: migrate to ESLint flat config (#1673)
Browse files Browse the repository at this point in the history
* chore: migrate to ESLint flat config

* chore: run prettier
  • Loading branch information
eglitise authored Sep 10, 2024
1 parent 01f8d84 commit cea7dd6
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 96 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

17 changes: 0 additions & 17 deletions .eslintrc.json

This file was deleted.

14 changes: 0 additions & 14 deletions app/common/renderer/.eslintrc.json

This file was deleted.

59 changes: 59 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import path from 'node:path';
import {fileURLToPath} from 'node:url';

import {includeIgnoreFile} from '@eslint/compat';
import {FlatCompat} from '@eslint/eslintrc';
import js from '@eslint/js';
import reactPlugin from 'eslint-plugin-react';
import globals from 'globals';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, '.gitignore');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
name: 'React Plugin',
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
...reactPlugin.configs.flat.recommended,
},
...compat.extends('@appium/eslint-config-appium-ts'),
{
name: 'JS/TS Files',
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
document: 'readonly',
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
varsIgnorePattern: 'React',
},
],
'react/prop-types': 'off',
},
},
{
ignores: [
...includeIgnoreFile(gitignorePath).ignores,
'**/.*', // dotfiles aren't ignored by default in FlatConfig
'**/*.xml',
'**/*.html',
],
},
];
Loading

0 comments on commit cea7dd6

Please sign in to comment.