Skip to content

Commit

Permalink
Merge pull request #116 from etn-ccis/feature/blui-6228-eslint-9
Browse files Browse the repository at this point in the history
Upgrade ESlint version 9 support flat config
  • Loading branch information
joebochill authored Oct 24, 2024
2 parents c9c87e8 + f141df8 commit 2f17cba
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 406 deletions.
12 changes: 12 additions & 0 deletions eslint-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## v4.0.0 (unreleased)

### Changed

- Update to support ESlint version 9.
- Removed deprecated no-var-requires rule in favor of no-require-imports rule.
- Removed deprecated no-throw-literal rule.

### Fixed

- Update naming-convention rules ([#96](https://github.com/etn-ccis/blui-code-standards/issues/96)).

## v3.0.1 (June 8, 2022)

### Changed
Expand Down
17 changes: 8 additions & 9 deletions eslint-config/blui-rules.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const bluiRules = {
module.exports = {
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: ['camelCase'],
format: ['camelCase', 'PascalCase'],
},
{
selector: 'variable',
Expand Down Expand Up @@ -36,18 +36,20 @@ const bluiRules = {
format: ['camelCase'],
leadingUnderscore: 'require',
},

{
selector: 'typeLike',
format: ['PascalCase'],
},
{
selector: 'import',
format: ['camelCase', 'PascalCase'],
},
],
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/explicit-module-boundary-types': ['error', { allowArgumentsExplicitlyTypedAsAny: true }],
'@typescript-eslint/no-array-constructor': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
Expand Down Expand Up @@ -90,7 +92,6 @@ const bluiRules = {
'no-return-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-throw-literal': 'error',
'no-unused-expressions': 'error',
'no-useless-call': 'error',
'no-undef-init': 'error',
Expand All @@ -110,8 +111,6 @@ const bluiRules = {
'prefer-spread': 'error',
'prefer-template': 'error',
'sort-imports': 'off',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"]
};

module.exports = bluiRules;
22 changes: 11 additions & 11 deletions eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brightlayer-ui/eslint-config",
"version": "3.0.1",
"version": "4.0.0-alpha.0",
"description": "ESLint profile for Brightlayer UI",
"author": "Brightlayer UI <brightlayer-ui@eaton.com>",
"main": "index.js",
Expand Down Expand Up @@ -30,16 +30,18 @@
"prettier": "prettier \"**/**.{ts,tsx,js,jsx,json,css,scss,html,md}\" --write"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^5.9.0",
"eslint": ">= 8.6.0",
"typescript": ">= 4.0.0"
"typescript": "5.5.4"
},
"dependencies": {
"@typescript-eslint/parser": "^5.9.0",
"eslint-config-prettier": ">= 8.0.0"
"@eslint/js": "^9.13.0",
"typescript-eslint": "^8.11.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-config-prettier":"^9.1.0",
"@typescript-eslint/parser": "^8.10.0",
"eslint": ">= 9.12.0"
},
"optionalDependencies": {
"eslint-plugin-react": "^7.28.0"
"eslint-plugin-react": "^7.37.1"
},
"keywords": [
"eslint",
Expand All @@ -51,10 +53,8 @@
"prettier": "@brightlayer-ui/prettier-config",
"devDependencies": {
"@brightlayer-ui/prettier-config": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^5.9.0",
"eslint": ">= 8.6.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react": "^7.37.1",
"prettier": "3.2.5",
"typescript": ">= 4.0.0"
"typescript": "5.5.4"
}
}
31 changes: 20 additions & 11 deletions eslint-config/ts.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
const tsProfile = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'eslint-config-prettier',
],
rules: require('./blui-rules'),
};
const js = require('@eslint/js');
const tseslint = require('typescript-eslint');
const prettierRecommended = require('eslint-plugin-prettier/recommended');
const typescriptEslintParser = require('@typescript-eslint/parser');
const bluiRules = require('./blui-rules.js');

module.exports = tsProfile;
module.exports = [
js.configs.recommended,
tseslint.configs.eslintRecommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
prettierRecommended,
{
languageOptions: {
parser: typescriptEslintParser
},
rules: {
...bluiRules
},
}
];
47 changes: 26 additions & 21 deletions eslint-config/tsx.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
const tsxProfile = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'eslint-config-prettier',
],
settings: {
react: {
version: 'detect',
const js = require('@eslint/js');
const reactRecommened = require('eslint-plugin-react/configs/recommended.js');
const tseslint = require('typescript-eslint');
const prettierRecommended = require('eslint-plugin-prettier/recommended');
const typescriptEslintParser = require('@typescript-eslint/parser');
const bluiRules = require('./blui-rules.js');

module.exports = [
js.configs.recommended,
tseslint.configs.eslintRecommended,
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
reactRecommened,
prettierRecommended,
{
languageOptions: {
parser: typescriptEslintParser
},
settings: {
react: {
version: 'detect',
},
},
},
rules: Object.assign(
{
rules: {
'react/prop-types': 'off',
'react/display-name': 'off',
...bluiRules
},
require('./blui-rules')
),
};

module.exports = tsxProfile;
}
];
Loading

0 comments on commit 2f17cba

Please sign in to comment.