Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial migration to new ESLint flat config format #3213

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

117 changes: 0 additions & 117 deletions .eslintrc.js

This file was deleted.

153 changes: 153 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
process.env.ENABLE_NEW_JSX_TRANSFORM = 'true';

const { FlatCompat } = require('@eslint/eslintrc');
const graphqlPlugin = require('eslint-plugin-graphql');

// To be able to load legacy ESLint configurations and plugins (https://github.com/eslint/eslintrc)
// TODO: remove once the new flat format is fully supported.
const compat = new FlatCompat();

/**
* @type {import("eslint").Linter.FlatConfig[]}
*/
module.exports = [
// Global ignores
{
ignores: [
'_translations/',
'dist/',
'build/',
'node_modules/*',
'**/node_modules/*',
'packages/application-shell/test-utils/index.js',
'packages/application-shell-connectors/test-utils/index.js',
'packages/sdk/test-utils/index.js',
'**/.cache/*',
],
},
...compat.extends('@commercetools-frontend/eslint-config-mc-app'),
{
files: ['**/*.{js,jsx,ts,tsx,cjs,mjs}'],
rules: {
'import/order': [
'error',
{
alphabetize: { order: 'asc', caseInsensitive: true },
pathGroups: [
{
pattern: 'jest-mock',
group: 'external',
position: 'before',
},
{
pattern: 'msw',
group: 'external',
position: 'before',
},
{
pattern: 'react',
group: 'external',
position: 'before',
},
{
pattern: 'prop-types',
group: 'external',
position: 'before',
},
{
pattern: '@emotion/**',
group: 'external',
position: 'before',
},
{
pattern: '@commercetools-frontend/**',
group: 'external',
position: 'after',
},
{
pattern: '@commercetools-uikit/**',
group: 'external',
position: 'after',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
},
],
},
},
{
files: ['**/*.mc.graphql'],
plugins: {
graphql: graphqlPlugin,
},
rules: {
'graphql/template-strings': [
'error',
{
env: 'literal',
schemaJson: require('./schemas/mc.json'),
},
],
},
},
{
files: ['**/*.ctp.graphql'],
plugins: {
graphql: graphqlPlugin,
},
rules: {
'graphql/template-strings': [
'error',
{
env: 'literal',
schemaJson: require('./schemas/ctp.json'),
},
],
},
},
{
files: ['**/*.core.graphql'],
plugins: {
graphql: graphqlPlugin,
},
rules: {
'graphql/template-strings': [
'error',
{
env: 'literal',
schemaJson: require('./schemas/core.json'),
},
],
},
},
{
files: ['**/*.settings.graphql'],
plugins: {
graphql: graphqlPlugin,
},
rules: {
'graphql/template-strings': [
'error',
{
env: 'literal',
schemaJson: require('./schemas/settings.json'),
},
],
},
},
{
files: ['**/*.proxy.graphql'],
plugins: {
graphql: graphqlPlugin,
},
rules: {
'graphql/template-strings': [
'error',
{
env: 'literal',
schemaJson: require('./schemas/proxy.json'),
},
],
},
},
];
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"@commercetools/github-labels": "1.1.0",
"@commitlint/cli": "17.6.3",
"@commitlint/config-conventional": "17.6.3",
"@eslint/eslintrc": "2.1.2",
"@faker-js/faker": "7.6.0",
"@formatjs/cli": "6.1.1",
"@graphql-codegen/add": "3.2.3",
Expand Down
Loading
Loading