Skip to content

Commit d1e388d

Browse files
authored
feat: update repo to use flat config && update integration tests (#22)
* feat: update base eslint config file * chore: migrate eslintignore * chore: upgrade eslint, mocha and types * chore: install node types * feat: update legacy test configs * add readpackage helper * chore: fix ignore list and package scripts * chore: set up integration tests * feat: setup parser for svelte file * chore: switch to cjs * feat: integration tests * chore: fix eslint errors * fix lint error * fix config * fix: remove node prefix for CI * experiment with using execSync for integrations * chore: fix node env * fix * fix undefined error with legacy config * debug * reduce severity * feat: switch to eslint class * Revert "feat: switch to eslint class" This reverts commit 2c8b987. * revert * try: removing version check * ignore engines * add check
1 parent df9bd1f commit d1e388d

26 files changed

+1842
-1134
lines changed

.env-cmdrc.js .env-cmdrc.cjs

File renamed without changes.

.eslintignore

-11
This file was deleted.

.eslintrc.js

-137
This file was deleted.

.prettierignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
/docs/.vuepress/dist
99
/node_modules
1010
/tests/fixtures
11-
/tests-integrations/config-recommended
11+
/tests-integrations
1212

1313
# ignore files
1414
/CHANGELOG.md
1515
/.github/ISSUE_TEMPLATE/
1616
/.changeset/**/*.md
17+
/pnpm-lock.yaml
File renamed without changes.
File renamed without changes.

eslint.config.mjs

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
2+
import markdown from 'eslint-plugin-markdown'
3+
import tseslint from 'typescript-eslint'
4+
import process from 'process'
5+
6+
export default [
7+
eslintPluginPrettierRecommended,
8+
...markdown.configs.recommended,
9+
{
10+
rules: {
11+
'accessor-pairs': 2,
12+
'brace-style': [2, '1tbs', { allowSingleLine: true }],
13+
camelcase: [2, { properties: 'never' }],
14+
'comma-dangle': [2, 'never'],
15+
'constructor-super': 2,
16+
curly: [2, 'multi-line'],
17+
eqeqeq: [2, 'allow-null'],
18+
'handle-callback-err': [2, '^(err|error)$'],
19+
'new-cap': [2, { newIsCap: true, capIsNew: false }],
20+
'new-parens': 2,
21+
'no-array-constructor': 2,
22+
'no-caller': 2,
23+
'no-class-assign': 2,
24+
'no-cond-assign': 2,
25+
'no-const-assign': 2,
26+
'no-control-regex': 2,
27+
'no-delete-var': 2,
28+
'no-dupe-args': 2,
29+
'no-dupe-class-members': 2,
30+
'no-dupe-keys': 2,
31+
'no-duplicate-case': 2,
32+
'no-empty-character-class': 2,
33+
'no-empty-pattern': 2,
34+
'no-eval': 2,
35+
'no-ex-assign': 2,
36+
'no-extend-native': 2,
37+
'no-extra-bind': 2,
38+
'no-extra-boolean-cast': 2,
39+
'no-extra-parens': [2, 'functions'],
40+
'no-fallthrough': 2,
41+
'no-floating-decimal': 2,
42+
'no-func-assign': 2,
43+
'no-implied-eval': 2,
44+
'no-inner-declarations': [2, 'functions'],
45+
'no-invalid-regexp': 2,
46+
'no-irregular-whitespace': 2,
47+
'no-iterator': 2,
48+
'no-label-var': 2,
49+
'no-labels': [2, { allowLoop: false, allowSwitch: false }],
50+
'no-lone-blocks': 2,
51+
'no-mixed-spaces-and-tabs': 2,
52+
'no-multi-str': 2,
53+
'no-native-reassign': 2,
54+
'no-negated-in-lhs': 2,
55+
'no-new-object': 2,
56+
'no-new-require': 2,
57+
'no-new-symbol': 2,
58+
'no-new-wrappers': 2,
59+
'no-obj-calls': 2,
60+
'no-octal': 2,
61+
'no-octal-escape': 2,
62+
'no-path-concat': 2,
63+
'no-proto': 2,
64+
'no-redeclare': 2,
65+
'no-regex-spaces': 2,
66+
'no-return-assign': [2, 'except-parens'],
67+
'no-self-assign': 2,
68+
'no-self-compare': 2,
69+
'no-sequences': 2,
70+
'no-shadow-restricted-names': 2,
71+
'no-spaced-func': 2,
72+
'no-sparse-arrays': 2,
73+
'no-this-before-super': 2,
74+
'no-throw-literal': 2,
75+
'no-trailing-spaces': 2,
76+
'no-undef': 2,
77+
'no-undef-init': 2,
78+
'no-unexpected-multiline': 2,
79+
'no-unmodified-loop-condition': 2,
80+
'no-unneeded-ternary': [2, { defaultAssignment: false }],
81+
'no-unreachable': 2,
82+
'no-unsafe-finally': 2,
83+
'no-unused-vars': [2, { vars: 'all', args: 'none' }],
84+
'no-useless-call': 2,
85+
'no-useless-computed-key': 2,
86+
'no-useless-constructor': 2,
87+
'no-useless-escape': 0,
88+
'no-whitespace-before-property': 2,
89+
'no-with': 2,
90+
'one-var': [2, { initialized: 'never' }],
91+
'use-isnan': 2,
92+
'valid-typeof': 2,
93+
'wrap-iife': [2, 'any'],
94+
yoda: [2, 'never'],
95+
'prefer-const': 2,
96+
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
97+
'object-shorthand': 'error'
98+
}
99+
},
100+
...tseslint.config({
101+
files: ['*.ts'],
102+
extends: [...tseslint.configs.recommended],
103+
rules: {
104+
'@typescript-eslint/no-non-null-assertion': 'off',
105+
'@typescript-eslint/consistent-type-imports': 'error'
106+
},
107+
languageOptions: {
108+
parserOptions: {
109+
parser: tseslint.parser
110+
}
111+
}
112+
}),
113+
{
114+
files: ['*.vue'],
115+
parser: 'vue-eslint-parser',
116+
languageOptions: {
117+
ecmaVersion: 2021,
118+
sourceType: 'module'
119+
}
120+
},
121+
{
122+
files: ['js', 'ts', 'vue', 'svelte'].map(ext => [`**/*.md/*.${ext}`]),
123+
processor: 'markdown/markdown',
124+
rules: {
125+
'prettier/prettier': 'off'
126+
}
127+
},
128+
{
129+
ignores: [
130+
'!docs/.vuepress/',
131+
'!.github/',
132+
'!.vscode/',
133+
'.nyc_output/',
134+
'assets/',
135+
'coverage/',
136+
'dist/',
137+
'docs/.vuepress/dist/',
138+
'node_modules/',
139+
'tests-integrations/'
140+
]
141+
}
142+
]

package.json

+10-7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
}
2525
},
2626
"dependencies": {
27+
"@types/node": "^20.14.9",
2728
"debug": "^4.3.1",
2829
"eslint-compat-utils": "^0.5.1",
2930
"svelte-eslint-parser": ">=0.9.0 <1.0.0"
@@ -45,22 +46,24 @@
4546
"@types/eslint": "^7.2.10",
4647
"@types/eslint-scope": "^3.7.0",
4748
"@types/eslint-visitor-keys": "^1.0.0",
49+
"@types/mocha": "^10.0.7",
4850
"@typescript-eslint/eslint-plugin": "^6.0.0",
4951
"@typescript-eslint/parser": "^6.0.0",
5052
"env-cmd": "^10.1.0",
51-
"eslint": "^8.0.0",
52-
"eslint-config-prettier": "^8.0.0",
53-
"eslint-plugin-markdown": "^2.0.0",
54-
"eslint-plugin-prettier": "^5.0.0",
53+
"eslint": "^9.6.0",
54+
"eslint-config-prettier": "^9.1.0",
55+
"eslint-plugin-markdown": "^5.0.0",
56+
"eslint-plugin-prettier": "^5.1.3",
5557
"eslint4b": "^7.16.0",
56-
"mocha": "^8.0.0",
58+
"mocha": "^10.5.2",
5759
"nyc": "^15.0.0",
5860
"opener": "^1.5.1",
5961
"prettier": "^3.0.0",
6062
"rimraf": "^3.0.0",
6163
"svelte": "^3.37.0",
6264
"ts-node": "^9.0.0",
6365
"typescript": "~5.0.0",
66+
"typescript-eslint": "^7.14.1",
6467
"vue-eslint-editor": "^1.1.0",
6568
"vue-eslint-parser": "^7.6.0",
6669
"vue-github-button": "^1.2.0",
@@ -95,14 +98,14 @@
9598
"docs": "npm run build && vuepress dev docs",
9699
"docs:build": "npm run build && vuepress build docs",
97100
"generate": "ts-node --transpile-only scripts/update.ts && prettier . --write",
98-
"lint": "eslint . --ext js,ts,vue,md --ignore-pattern \"/tests/fixtures\"",
101+
"lint": "eslint . --ignore-pattern \"/tests/fixtures\"",
99102
"lint:docs": "prettier docs --check",
100103
"format": "yarn lint --fix && yarn format:docs",
101104
"format:docs": "prettier docs --write",
102105
"test": "mocha --require ts-node/register \"./tests/**/*.ts\"",
103106
"test:debug": "mocha --require ts-node/register/transpile-only \"./tests/**/*.ts\"",
104107
"test:coverage": "nyc mocha --require ts-node/register \"./tests/**/*.ts\" --timeout 60000",
105-
"test:integrations": "mocha ./tests-integrations/*.js --timeout 60000",
108+
"test:integrations": "mocha --require ts-node/register \"./tests-integrations/*.ts\" --timeout 60000",
106109
"prerelease": "yarn build",
107110
"release": "changeset publish",
108111
"version:ci": "env-cmd -e version-ci yarn generate && changeset version"

tests-integrations/config-recommended.js

-38
This file was deleted.

0 commit comments

Comments
 (0)