Skip to content

Commit f22853d

Browse files
committed
feat: move all eslint-related stuff to main repo
It's becoming harder and harder to maintain `create-eslint-config` separately as the tooling space evolves. So I decided to merge it back to the main repo. The functionality remains mostly the same, except that we now explicitly generate an oxlint config file instead of passing options via CLI args. Previously I was adding `--ignore-path .gitignore` to oxlint commands, but it turns out `.gitignore` is automatically respected inside a git repo[^1]. So I skipped that part. The general idea of this refactoring is that each functionality should be self-contained inside its own template folder, so that in the future we can test them independently or even publish them as separate packages again. Still a lot of work to do in that direction, but this is a start. [^1]: https://oxc.rs/docs/guide/usage/linter/cli.html#ignore-files
1 parent bc93a78 commit f22853d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+266
-2888
lines changed

β€ŽLICENSEβ€Ž

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -447,33 +447,4 @@ Repository: git://github.com/mde/ejs.git
447447
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
448448
> See the License for the specific language governing permissions and
449449
> limitations under the License.
450-
>
451-
452-
## @vue/create-eslint-config
453-
454-
License: MIT
455-
By: Haoqun Jiang
456-
Repository: git+https://github.com/vuejs/create-eslint-config.git
457-
458-
> MIT License
459-
>
460-
> Copyright (c) 2022 vuejs
461-
>
462-
> Permission is hereby granted, free of charge, to any person obtaining a copy
463-
> of this software and associated documentation files (the "Software"), to deal
464-
> in the Software without restriction, including without limitation the rights
465-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
466-
> copies of the Software, and to permit persons to whom the Software is
467-
> furnished to do so, subject to the following conditions:
468-
>
469-
> The above copyright notice and this permission notice shall be included in all
470-
> copies or substantial portions of the Software.
471-
>
472-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
473-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
474-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
475-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
476-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
477-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
478-
> SOFTWARE.
479450
>

β€Žindex.tsβ€Ž

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
import generateReadme from './utils/generateReadme'
2121
import getCommand from './utils/getCommand'
2222
import getLanguage from './utils/getLanguage'
23-
import renderEslint from './utils/renderEslint'
2423
import { trimBoilerplate, removeCSSImport, emptyRouterConfig } from './utils/trimBoilerplate'
2524

2625
import cliPackageJson from './package.json' with { type: 'json' }
@@ -511,25 +510,40 @@ async function init() {
511510
}
512511

513512
// Render ESLint config
514-
if (needsEslint || needsOxlint) {
515-
renderEslint(root, {
516-
needsTypeScript,
517-
needsOxlint,
518-
needsVitest,
519-
needsCypress,
520-
needsCypressCT,
521-
needsPrettier,
522-
needsPlaywright,
523-
})
524-
render('config/eslint')
525-
}
513+
if (needsEslint) {
514+
render('linting/base')
526515

527-
if (needsOxlint) {
528-
render('config/oxlint')
516+
if (needsTypeScript) {
517+
render('linting/core/ts')
518+
} else {
519+
render('linting/core/js')
520+
}
521+
522+
if (needsCypress) {
523+
render('linting/cypress')
524+
}
525+
if (needsCypressCT) {
526+
render('linting/cypress-ct')
527+
}
528+
if (needsPlaywright) {
529+
render('linting/playwright')
530+
}
531+
if (needsVitest) {
532+
render('linting/vitest')
533+
}
534+
535+
// These configs only disable rules, so they should come last.
536+
if (needsPrettier) {
537+
render('linting/prettier')
538+
}
539+
if (needsOxlint) {
540+
render('linting/oxlint')
541+
}
529542
}
530543

531544
if (needsPrettier) {
532-
render('config/prettier')
545+
render('formatting/prettier')
546+
// TODO: add oxfmt option in the next PR
533547
}
534548

535549
// use rolldown-vite if the feature is enabled
@@ -615,7 +629,7 @@ async function init() {
615629
root,
616630
() => {},
617631
(filepath) => {
618-
if (filepath.endsWith('.js') && !filepath.endsWith('eslint.config.js')) {
632+
if (filepath.endsWith('.js')) {
619633
const tsFilePath = filepath.replace(/\.js$/, '.ts')
620634
if (fs.existsSync(tsFilePath)) {
621635
fs.unlinkSync(filepath)
@@ -694,7 +708,7 @@ async function init() {
694708
if (!dotGitDirectoryState.hasDotGitDirectory) {
695709
outroMessage += `
696710
${dim('|')} ${language.infos.optionalGitCommand}
697-
711+
698712
${bold(green('git init && git add -A && git commit -m "initial commit"'))}`
699713
}
700714

β€Žlinters-and-formatters/.github/MAINTENANCE.mdβ€Ž

Lines changed: 0 additions & 10 deletions
This file was deleted.

β€Žlinters-and-formatters/.github/renovate.jsonβ€Ž

Lines changed: 0 additions & 6 deletions
This file was deleted.

β€Žlinters-and-formatters/.github/workflows/publish.ymlβ€Ž

Lines changed: 0 additions & 25 deletions
This file was deleted.

β€Žlinters-and-formatters/.gitignoreβ€Ž

Lines changed: 0 additions & 104 deletions
This file was deleted.

β€Žlinters-and-formatters/LICENSEβ€Ž

Lines changed: 0 additions & 21 deletions
This file was deleted.

β€Žlinters-and-formatters/README.mdβ€Ž

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
Β (0)