Skip to content

Commit

Permalink
chore: Update eslint and cosmiconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidnioulz committed Feb 17, 2025
1 parent 6eec7c8 commit 5a7d893
Show file tree
Hide file tree
Showing 8 changed files with 838 additions and 618 deletions.
135 changes: 0 additions & 135 deletions .eslintrc.cjs

This file was deleted.

180 changes: 180 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
import eslint from '@eslint/js'
import tsEslint from 'typescript-eslint'
import prettier from 'eslint-config-prettier'
import eslintPluginImport from 'eslint-plugin-import'
import eslintPluginJest from 'eslint-plugin-jest'
import eslintPluginVue from 'eslint-plugin-vue'
import globals from 'globals'

export default [
{
ignores: [
'*.d.ts',
'.circleci/config.yml',
'.github/dependabot.yml',
'.mergify/config.yml',
'_.log',
'_.lock',
'*.tgz',
'.gitignore',
'.eslintignore',
'.prettierignore',
'**/node_modules',
'**/coverage',
'**/dist',
'examples/*/Input.*',
'**/dist',
],
},
eslint.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.es2022,
...globals.node,
},
parserOptions: {
ecmaVersion: 2022,
},
},
settings: {
'import/resolver': {
typescript: true,
},
'import/core-modules': [
'vue',
'@vue/compiler-core',
'@vue/compiler-dom',
'@vue/compiler-sfc',
'@vue/shared',
],
},
plugins: {
import: eslintPluginImport,
jest: eslintPluginJest,
},
},
...tsEslint.config(
{ ignores: ['*.d.ts', '**/coverage', '**/dist'] },
{
extends: [
eslint.configs.recommended,
...tsEslint.configs.recommended,
...eslintPluginVue.configs['flat/recommended'],
],
files: ['**/*.{ts,vue}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: globals.browser,
parserOptions: {
parser: tsEslint.parser,
},
},
rules: {
'vue/prefer-import-from-vue': 'off',
'line-comment-position': 'error',
'newline-before-return': 'error',
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-param-reassign': [
'error',
{
ignorePropertyModificationsFor: ['descriptor'],
props: true,
},
],
'prefer-destructuring': 'off',
'import/extensions': 'off',
'import/newline-after-import': ['error', { count: 1 }],
'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'],
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'__mocks__/*',
'**/*.spec.ts',
'.*.config.js',
'.*.config.cjs',
'.*.config.ts',
'*.config.js',
'*.config.cjs',
'*.config.ts',
'.*rc.js',
'.*rc.cjs',
'eslint.config.mjs',
],
packageDir: ['.'],
},
],
'import/order': [
'error',
{
alphabetize: { order: 'asc' },
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
},
],
'import/prefer-default-export': 'off',
'jest/no-disabled-tests': 'error',
'jest/no-focused-tests': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'no-undef': 'off',
'no-shadow': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/no-use-before-define': 'error',
'arrow-body-style': 'off',
'class-methods-use-this': 'off',
'prefer-arrow-callback': 'off',
quotes: ['error', 'single', { allowTemplateLiterals: false, avoidEscape: true }],
},
},
),
{
files: ['**/*.cjs'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['__mocks__/*'],
languageOptions: {
globals: globals.jest,
},
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
},
{
files: ['jest.setup.ts'],
languageOptions: {
globals: globals.jest,
},
rules: {
'jest/no-export': 'off',
},
},
{
files: ['examples/**/Input*'],
rules: {
'no-console': 'off',
'no-debugger': 'off',
'import/no-extraneous-dependencies': 'off',
},
},
{
files: ['examples/**/transformation.cjs'],
rules: {
'no-console': 'off',
'no-debugger': 'warn',
'no-param-reassign': 'off',
},
},
prettier,
]
1 change: 1 addition & 0 deletions examples/rename-imports/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

<script lang="ts">
import { CmpButton, IconQuote } from '@orgname/old-package'
export default {
components: {
CmpButton,
Expand Down
27 changes: 16 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"format:fix": "yarn prettier --write .",
"lint": "yarn lint:eslint . && yarn lint:types",
"lint:fix": "yarn lint:eslint:fix . && yarn lint:types",
"lint:eslint": "yarn eslint --cache --ext .ts,.js",
"lint:eslint": "yarn eslint --cache",
"lint:eslint:staged": "yarn lint:eslint:fix",
"lint:eslint:fix": "yarn lint:eslint --fix",
"lint:types": "tsc --noEmit",
Expand All @@ -55,15 +55,15 @@
"@types/inquirer-autocomplete-prompt": "^3.0.0",
"@types/jscodeshift": "^0.11.6",
"@types/yargs": "^17.0.24",
"cosmiconfig": "^8.3.4",
"cosmiconfig-typescript-loader": "^5.0.0",
"cosmiconfig": "^9.0.0",
"cosmiconfig-typescript-loader": "^6.1.0",
"debug": "^4.1.1",
"fuzzy": "^0.1.3",
"globby": "^13.2.2",
"inquirer": "^9.2.10",
"inquirer-autocomplete-prompt": "^3.0.0",
"jscodeshift": "^0.15.0",
"lint-staged": "^14.0.0",
"lint-staged": "^15.4.3",
"lru-cache": "^10.0.1",
"rollup-plugin-vue": "^6.0.0",
"source-map-js": "^1.0.2",
Expand All @@ -73,32 +73,37 @@
},
"devDependencies": {
"@commitlint/config-conventional": "^17.7.0",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.20.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-typescript": "^11.1.2",
"@types/jest": "^29.5.3",
"@types/node": "^20.5.0",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@typescript-eslint/eslint-plugin": "^8.24.0",
"@typescript-eslint/parser": "^8.24.0",
"chalk": "^4.1.2",
"commitizen": "^4.3.0",
"commitlint": "^17.7.1",
"eslint": "^8.0.0",
"eslint": "^9.20.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-prettier": "^10.0.1",
"eslint-import-resolver-typescript": "^3.5.3",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-vue": "^9.32.0",
"eslint-plugin-yml": "^1.2.0",
"fast-check": "^3.13.0",
"globals": "^15.15.0",
"husky": "^8.0.3",
"jest": "^29.6.2",
"memfs": "^4.2.1",
"prettier": "^3.0.2",
"rollup": "^3.28.0",
"rollup": "^4.34.8",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-externals": "^6.1.1",
"rollup-plugin-node-externals": "^8.0.0",
"ts-jest": "^29.1.1",
"typescript": "^5.1.6",
"typescript-eslint": "^8.24.0",
"word-wrap": "^1.2.5",
"zod-fast-check": "^0.10.0"
},
Expand Down
Loading

0 comments on commit 5a7d893

Please sign in to comment.