Skip to content

Commit

Permalink
chore: add proper globals for node scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
birtles committed Jun 20, 2024
1 parent 57fbef2 commit ab34fd8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 44 deletions.
74 changes: 34 additions & 40 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ export default [
...tseslint.configs.recommended,
...tailwind.configs['flat/recommended'],
{
plugins: { vitest },

languageOptions: {
globals: {
...globals.browser,
},
globals: { ...globals.browser },

parser: tsParser,
ecmaVersion: 2022,
Expand All @@ -35,49 +31,23 @@ export default [
rules: {
curly: 'error',
'linebreak-style': ['error', 'unix'],

'no-constant-condition': [
'error',
{
checkLoops: false,
},
],

'no-constant-condition': ['error', { checkLoops: false }],
'no-prototype-builtins': 'off',

'prefer-const': [
'error',
{
destructuring: 'all',
},
],

quotes: [
'error',
'single',
{
avoidEscape: true,
},
],

'prefer-const': ['error', { destructuring: 'all' }],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'always'],

'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
ignoreMemberSort: false,
allowSeparatedGroups: true,
},
],

'tailwindcss/classnames-order': 'off',
'tailwindcss/no-custom-classname': 'off',

...vitest.configs.recommended.rules,
'vitest/no-identical-title': ['error'],

'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-floating-promises': [
Expand All @@ -100,20 +70,44 @@ export default [
},
},
{
files: ['**/*.js', '**/*.mjs', 'tests/**/*', 'scripts/**/*'],

files: ['src/**/*.test.ts'],
plugins: { vitest },
rules: {
...vitest.configs.recommended.rules,
'vitest/no-identical-title': ['error'],
},
},
{
files: [
'*.{cjs,js,ts}',
'scripts/**/*.{cjs,js,ts}',
'tests/**/*.{cjs,js,ts}',
],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',

parserOptions: {
project: null,
},
},

rules: {
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-misused-promises': 'off',
},
},
{
files: ['*.cjs', 'scripts/**/*.cjs'],
languageOptions: {
globals: {
...globals.node,
},
sourceType: 'commonjs',
},
},
{
files: ['*.{js,ts}', 'scripts/**/*.{js,ts}'],
languageOptions: {
globals: {
...globals.nodeBuiltin,
},
},
},
];
2 changes: 0 additions & 2 deletions postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-env node */

module.exports = {
plugins: {
tailwindcss: {},
Expand Down
1 change: 0 additions & 1 deletion scripts/sync-manifest-version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env node */
import * as fs from 'node:fs';
import * as url from 'node:url';
import { parseSemVer } from 'semver-parser';
Expand Down
1 change: 0 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env node */
/* eslint @typescript-eslint/no-var-requires: 0 */
import CopyWebpackPlugin from 'copy-webpack-plugin';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
Expand Down

0 comments on commit ab34fd8

Please sign in to comment.