-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated blueprints to install eslint@v9 (#146)
* chore: Updated dependencies * chore: Updated eslint to v9 * chore: Updated fixtures * chore: Added changeset --------- Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
- Loading branch information
Showing
27 changed files
with
808 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@codemod-utils/cli": minor | ||
--- | ||
|
||
Updated blueprints to install eslint@v9 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
<% if (options.codemod.hasTypeScript) { %>import babelEslintParser from '@babel/eslint-parser'; | ||
import eslint from '@eslint/js'; | ||
import eslintPluginImport from 'eslint-plugin-import'; | ||
import eslintPluginN from 'eslint-plugin-n'; | ||
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended'; | ||
import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort'; | ||
import eslintPluginTypescriptSortKeys from 'eslint-plugin-typescript-sort-keys'; | ||
import globals from 'globals'; | ||
// eslint-disable-next-line import/no-unresolved | ||
import tseslint from 'typescript-eslint'; | ||
|
||
const parserOptionsJs = { | ||
babelOptions: { | ||
plugins: [ | ||
[ | ||
'@babel/plugin-proposal-decorators', | ||
{ | ||
decoratorsBeforeExport: true, | ||
}, | ||
], | ||
], | ||
}, | ||
ecmaFeatures: { | ||
modules: true, | ||
}, | ||
ecmaVersion: 'latest', | ||
requireConfigFile: false, | ||
}; | ||
|
||
const parserOptionsTs = { | ||
projectService: true, | ||
tsconfigRootDir: import.meta.dirname, | ||
}; | ||
|
||
export default tseslint.config( | ||
{ | ||
ignores: [ | ||
'dist/', | ||
'dist-for-testing/', | ||
'node_modules/', | ||
'src/blueprints/', | ||
'tests/fixtures/', | ||
'tmp/', | ||
'!.*', | ||
'.*/', | ||
], | ||
}, | ||
|
||
{ | ||
linterOptions: { | ||
reportUnusedDisableDirectives: 'error', | ||
}, | ||
}, | ||
{ | ||
plugins: { | ||
'simple-import-sort': eslintPluginSimpleImportSort, | ||
}, | ||
rules: { | ||
curly: 'error', | ||
'simple-import-sort/imports': 'error', | ||
'simple-import-sort/exports': 'error', | ||
}, | ||
}, | ||
eslint.configs.recommended, | ||
eslintPluginImport.flatConfigs.recommended, | ||
eslintPluginPrettier, | ||
|
||
// JavaScript files | ||
{ | ||
files: ['**/*.js'], | ||
languageOptions: { | ||
parser: babelEslintParser, | ||
parserOptions: parserOptionsJs, | ||
}, | ||
rules: { | ||
'import/no-duplicates': 'error', | ||
}, | ||
}, | ||
|
||
// TypeScript files | ||
{ | ||
extends: [ | ||
...tseslint.configs.recommended, | ||
eslintPluginImport.flatConfigs.typescript, | ||
], | ||
files: ['**/*.ts'], | ||
languageOptions: { | ||
parserOptions: parserOptionsTs, | ||
}, | ||
plugins: { | ||
'typescript-sort-keys': eslintPluginTypescriptSortKeys, | ||
}, | ||
rules: { | ||
'@typescript-eslint/array-type': 'error', | ||
'@typescript-eslint/consistent-type-imports': 'error', | ||
'@typescript-eslint/no-import-type-side-effects': 'error', | ||
'import/no-duplicates': 'error', | ||
'typescript-sort-keys/interface': 'error', | ||
'typescript-sort-keys/string-enum': 'error', | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
node: true, | ||
typescript: true, | ||
}, | ||
}, | ||
}, | ||
|
||
// Node files | ||
{ | ||
files: ['**/*.cjs'], | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
globals: { | ||
...globals.node, | ||
}, | ||
sourceType: 'script', | ||
}, | ||
plugins: { | ||
n: eslintPluginN, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.mjs'], | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
globals: { | ||
...globals.node, | ||
}, | ||
parserOptions: parserOptionsJs, | ||
sourceType: 'module', | ||
}, | ||
plugins: { | ||
n: eslintPluginN, | ||
}, | ||
}, | ||
);<% } else { %>import babelEslintParser from '@babel/eslint-parser'; | ||
import eslint from '@eslint/js'; | ||
import eslintPluginImport from 'eslint-plugin-import'; | ||
import eslintPluginN from 'eslint-plugin-n'; | ||
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended'; | ||
import eslintPluginSimpleImportSort from 'eslint-plugin-simple-import-sort'; | ||
import globals from 'globals'; | ||
|
||
const parserOptionsJs = { | ||
babelOptions: { | ||
plugins: [ | ||
[ | ||
'@babel/plugin-proposal-decorators', | ||
{ | ||
decoratorsBeforeExport: true, | ||
}, | ||
], | ||
], | ||
}, | ||
ecmaFeatures: { | ||
modules: true, | ||
}, | ||
ecmaVersion: 'latest', | ||
requireConfigFile: false, | ||
}; | ||
|
||
export default tseslint.config( | ||
{ | ||
ignores: [ | ||
'dist/', | ||
'dist-for-testing/', | ||
'node_modules/', | ||
'src/blueprints/', | ||
'tests/fixtures/', | ||
'tmp/', | ||
'!.*', | ||
'.*/', | ||
], | ||
}, | ||
|
||
{ | ||
linterOptions: { | ||
reportUnusedDisableDirectives: 'error', | ||
}, | ||
}, | ||
{ | ||
plugins: { | ||
'simple-import-sort': eslintPluginSimpleImportSort, | ||
}, | ||
rules: { | ||
curly: 'error', | ||
'simple-import-sort/imports': 'error', | ||
'simple-import-sort/exports': 'error', | ||
}, | ||
}, | ||
eslint.configs.recommended, | ||
eslintPluginImport.flatConfigs.recommended, | ||
eslintPluginPrettier, | ||
|
||
// JavaScript files | ||
{ | ||
files: ['**/*.js'], | ||
languageOptions: { | ||
parser: babelEslintParser, | ||
parserOptions: parserOptionsJs, | ||
}, | ||
rules: { | ||
'import/no-duplicates': 'error', | ||
}, | ||
}, | ||
|
||
// Node files | ||
{ | ||
files: ['**/*.cjs'], | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
globals: { | ||
...globals.node, | ||
}, | ||
sourceType: 'script', | ||
}, | ||
plugins: { | ||
n: eslintPluginN, | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.mjs'], | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
globals: { | ||
...globals.node, | ||
}, | ||
parserOptions: parserOptionsJs, | ||
sourceType: 'module', | ||
}, | ||
plugins: { | ||
n: eslintPluginN, | ||
}, | ||
}, | ||
);<% } %> |
Oops, something went wrong.