Skip to content
Merged
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
13 changes: 10 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Use Node.js '23.x'
- name: Set up Node.js version
uses: actions/setup-node@v4
with:
node-version: '23.x'
- run: npm ci
node-version: 'latest'
- uses: actions/cache@v4
id: npm-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}-${{ secrets.NPM_CACHE_VERSION }}
- name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci
- run: npm run build --if-present
- run: npm test
- name: Coveralls
Expand Down
83 changes: 17 additions & 66 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ import { defineConfig, globalIgnores } from 'eslint/config';
import pluginJs from '@eslint/js';
import path from 'path';
import { fileURLToPath } from 'url';
import { glob } from 'glob';
import globals from 'globals';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import vitest from '@vitest/eslint-plugin';

const allComponentPaths = glob.sync('src/components/*/');
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);

Expand All @@ -31,7 +29,7 @@ const compat = new FlatCompat({

export default defineConfig([
...compat.extends('airbnb-base'),
globalIgnores(['src/__tests_helpers__/largeJsonResponse.json']),
globalIgnores(['src/__tests_helpers__/largeJsonResponse.json', 'dist/**']),
{
files: ['**/*.{js,cjs,jsx}'],
settings: {
Expand All @@ -48,69 +46,14 @@ export default defineConfig([
}
},
rules: {
'no-param-reassign': 'off',
'prettier/prettier': 'error',
'func-style': 'error',
// Turning this off allows us to import devDependencies in our build tools.
// We enable the rule in src/.eslintrc.js since that's the only place we
// want to disallow importing extraneous dependencies.
'import/no-extraneous-dependencies': 'off',
'prefer-destructuring': 'off',
'import/prefer-default-export': 'off',
'import/no-restricted-paths': [
'error',
{
zones: [
// prevent components from importing from other components, but allow
// importing from themselves
...allComponentPaths.map((componentPath, _, allPaths) => ({
target: componentPath,
from: [
'src/core',
'src/baseCode',
...allPaths.filter((p) => p !== componentPath)
]
})),
{
target: 'src/core',
from: 'src/baseCode'
},
{
target: 'src/utils',
from: ['src/core', 'src/components', 'src/baseCode']
},
{
target: 'src/constants',
from: ['src/core', 'src/components', 'src/utils', 'src/baseCode']
}
]
}
]
}
},
{
files: ['src/**/*.{cjs,js}'],
languageOptions: {
globals: {
turbine: 'readonly'
}
},
rules: {
'import/no-extraneous-dependencies': 'error'
}
},
{
files: ['test/unit/specs/**/*.{cjs,js}'],
plugins: {
vitest
},
rules: {
...vitest.configs.recommended.rules
'prettier/prettier': 'error'
}
},
{
files: ['test/**/*.{cjs,js}'],
files: ['src/**/*.js'],
rules: {
'import/no-extraneous-dependencies': 'error',
'no-param-reassign': 'off',
'import/extensions': [
'error',
{
Expand All @@ -120,17 +63,25 @@ export default defineConfig([
}
},
{
files: ['scripts/**/*.{cjs,js}'],
files: ['eslint.config.js'],
rules: {
'no-console': 'off',
'import/extensions': [
'import/no-extraneous-dependencies': [
'error',
{
js: 'always'
devDependencies: true
}
]
}
},
{
files: ['src/**/*.test.js}'],
plugins: {
vitest
},
rules: {
...vitest.configs.recommended.rules
}
},

pluginJs.configs.recommended,
eslintPluginPrettierRecommended
Expand Down
Loading