Skip to content

Commit

Permalink
chore(NOBUG): Start migration to new eslint config format
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-wade committed Jun 19, 2024
1 parent f59f7d5 commit 08463dd
Show file tree
Hide file tree
Showing 13 changed files with 292 additions and 53 deletions.
15 changes: 0 additions & 15 deletions .eslintrc.js

This file was deleted.

17 changes: 17 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { tsRecommended } from '@tybalt/eslint-config';

export default [
tsRecommended,
{
ignorePatterns: ['packages/**/node_modules'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
overrides: [
{
files: ['*.cy.js'],
extends: ['plugin:cypress/recommended'],
},
],
}
];
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"./packages/eleventy-plugin",
"./packages/eleventy-plugin-vanilla-example",
"./packages/esbuild-plugin",
"./packages/eslint-config",
"./packages/eslint-plugin",
"./packages/example",
"./packages/parser",
Expand All @@ -38,6 +39,7 @@
"./packages/website"
],
"devDependencies": {
"@tybalt/eslint-config": "workspace:^",
"@tybalt/eslint-plugin": "workspace:^",
"cypress": "^12.17.3",
"eslint": "^9.5.0",
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/config/.eslintrc.cjs

This file was deleted.

5 changes: 5 additions & 0 deletions packages/cli/config/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { tsRecommended } from "@tybalt/eslint-config";

export default [
tsRecommended
];
4 changes: 0 additions & 4 deletions packages/cypress/.eslintrc.js

This file was deleted.

5 changes: 5 additions & 0 deletions packages/cypress/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pluginCypress from 'eslint-plugin-cypress/flat'

export default [
pluginCypress.configs.recommended,
];
52 changes: 52 additions & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import tybaltEslintPlugin from '@tybalt/eslint-plugin';
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
import tseslint from 'typescript-eslint';
import globals from 'globals';
import js from '@eslint/js';

const recommended = [
js.configs.recommended,
{
parserOptions: {
ecmaVersion: 2022,
},
plugins: {
'@tybalt/eslint-plugin': tybaltEslintPlugin,
},
languageOptions: {
globals: {
...globals.es2022,
...globals.browser
}
},
rules: {
'@tybalt/component-names-are-multi-word': 'error',
},
}
];

const tsRecommended = tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
plugins: {
'@tybalt/eslint-plugin': tybaltEslintPlugin,
'@typescript-eslint': typescriptEslintPlugin
},
languageOptions: {
parser: '@typescript-eslint/parser',
globals: {
...globals.es2022,
...globals.browser
}
},
rules: {
'@tybalt/component-names-are-multi-word': 'error',
},
}
);

export {
recommended,
tsRecommended,
};
25 changes: 25 additions & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@tybalt/eslint-config",
"version": "0.2.0",
"description": "eslint configs for Tybalt",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"Tybalt",
"eslint",
"config"
],
"author": "Doug Wade <douglas.b.wade@gmail.com>",
"license": "MIT",
"peerDependencies": {
"eslint": ">= 9"
},
"dependencies": {
"@eslint/js": "^9.5.0",
"globals": "^12.4.0",
"typescript-eslint": "7.13.1"
}
}
6 changes: 0 additions & 6 deletions packages/eslint-plugin/.eslintrc.js

This file was deleted.

7 changes: 7 additions & 0 deletions packages/eslint-plugin/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default [
{
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
}
];
24 changes: 1 addition & 23 deletions packages/eslint-plugin/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
const rules = require('./rules/index.js');

module.exports = {
rules,
configs: {
recommended: {
parserOptions: {
ecmaVersion: 2022,
},
plugins: ['@tybalt/eslint-plugin'],
env: { browser: true, es2022: true },
extends: ['eslint:recommended'],
rules: {
'@tybalt/component-names-are-multi-word': 'error',
},
},
'ts-recommended': {
plugins: ['@typescript-eslint', '@tybalt/eslint-plugin'],
parser: '@typescript-eslint/parser',
env: { browser: true, es2022: true },
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
rules: {
'@tybalt/component-names-are-multi-word': 'error',
},
},
},
rules
};
Loading

0 comments on commit 08463dd

Please sign in to comment.