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

feat: support formatjs eslint rules #516

Merged
merged 1 commit into from
Mar 29, 2024
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
48 changes: 48 additions & 0 deletions config/.eslintrc.next.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// This file will be removed and replace "eslintrc.js" once all MFEs are ready
const { babel } = require('../lib/presets');

module.exports = {
plugins: ['formatjs'],
extends: '@edx/eslint-config',
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: true,
babelOptions: {
configFile: babel.resolvedFilepath || babel.defaultFilepath,
},
},
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'**/*.config.*',
'**/*.test.*',
'**/setupTest.js',
],
},
],
'import/no-unresolved': [
'error',
{
ignore: [
'env.config',
],
},
],
// https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/340#issuecomment-338424908
'jsx-a11y/anchor-is-valid': ['error', {
components: ['Link'],
specialLink: ['to'],
}],
'formatjs/enforce-description': ['error', 'literal'],
'import/no-import-module-export': 'off',
'react/function-component-definition': [2, { namedComponents: 'arrow-function' }],
},
globals: {
newrelic: false,
},
ignorePatterns: [
'module.config.js',
],
};
8 changes: 8 additions & 0 deletions lib/presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ const eslint = new ConfigPreset({
searchFilepaths,
});

// This will be removed and replace "eslint" once all MFEs are ready
const eslintNext = new ConfigPreset({
defaultFilename: '.eslintrc.next.js',
searchFilenames: ['.eslintrc.next', '.eslintrc.next.js'],
searchFilepaths,
});

const jest = new ConfigPreset({
defaultFilename: 'jest.config.js',
searchFilenames: ['jest.config.js'],
Expand Down Expand Up @@ -63,6 +70,7 @@ module.exports = {
'babel-preserve-modules': babelPreserveModules,
'babel-typescript': babelTypescript,
eslint,
'eslint-next': eslintNext, // This will be removed and replace "eslint" once all MFEs are ready
jest,
webpack,
webpackDevServer,
Expand Down
Loading
Loading