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
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

15 changes: 0 additions & 15 deletions .eslintrc

This file was deleted.

3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm test
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
coverage
jest.config.js
rollup.config.js
eslint.config.js
reactor-turbine-edge-*.tgz
adobe-reactor-turbine-edge*.tgz
__tests*
Expand Down
137 changes: 137 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/*
Copyright 2024 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

import { FlatCompat } from '@eslint/eslintrc';
// eslint-disable-next-line import/no-unresolved
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);

const compat = new FlatCompat({
baseDirectory: dirname
});

export default defineConfig([
...compat.extends('airbnb-base'),
globalIgnores(['src/__tests_helpers__/largeJsonResponse.json']),
{
files: ['**/*.{js,cjs,jsx}'],
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.cjs', '.mjs', '.jsx']
}
}
},
languageOptions: {
ecmaVersion: 2021,
globals: {
...globals.node
}
},
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
}
},
{
files: ['test/**/*.{cjs,js}'],
rules: {
'import/extensions': [
'error',
{
js: 'always'
}
]
}
},
{
files: ['scripts/**/*.{cjs,js}'],
rules: {
'no-console': 'off',
'import/extensions': [
'error',
{
js: 'always'
}
]
}
},

pluginJs.configs.recommended,
eslintPluginPrettierRecommended
]);
23 changes: 0 additions & 23 deletions jest.config.js

This file was deleted.

Loading