Skip to content

Commit

Permalink
improve: LDP-2585: Switch to ESLint flat config (#257)
Browse files Browse the repository at this point in the history
* improve: Switch to ESLint flat config

* LDP-2585: Update linting

---------

Co-authored-by: Alexandru <videoloss3@gmail.com>
  • Loading branch information
harrypango and vloss3 committed Sep 4, 2024
1 parent 531940b commit 848db66
Show file tree
Hide file tree
Showing 33 changed files with 1,569 additions and 2,013 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

15 changes: 0 additions & 15 deletions .eslintrc

This file was deleted.

16 changes: 8 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"editor.formatOnSave": true,
"eslint.useFlatConfig": true,
"volar.validation.template": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.options": {
"extensions": [
".html",
".js",
".vue"
]
"source.fixAll.eslint": "always",
"source.fixAll.vetur": "always",
"source.fixAll.vscode": "always"
},
"css.lint.unknownAtRules": "ignore",
"eslint.validate": [
"javascript",
"typescript",
"vue",
"vue-html"
],
"prettier.enable": false
}
17 changes: 9 additions & 8 deletions bin/nuxt-drupal-ce-init.cjs
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
#!/usr/bin/env node

const fs = require('fs')
const path = require('path')
const fs = require('node:fs')
const path = require('node:path')

const scaffoldDir = path.join(__dirname, '/../playground')
const target = '.'

function copyFile (source, target) {
function copyFile(source, target) {
const targetFile = target + '/' + path.basename(source)

// If target is a directory, a new file with the same name will be created
if (!fs.existsSync(targetFile)) {
// eslint-disable-next-line no-console
console.log(targetFile + ' - Created.')
fs.writeFileSync(targetFile, fs.readFileSync(source))
} else {
// eslint-disable-next-line no-console
}
else {
console.log(targetFile + ' - Existing, skipped.')
}
}

function syncDir (directory) {
function syncDir(directory) {
fs.readdirSync(scaffoldDir + '/' + directory).forEach(function (item) {
if (fs.lstatSync(scaffoldDir + '/' + directory + '/' + item).isDirectory()) {
syncDir(directory + '/' + item)
} else {
}
else {
copyFile(scaffoldDir + '/' + directory + '/' + item, target + '/' + directory)
}
})
Expand Down
17 changes: 17 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'

export default createConfigForNuxt({
features: {
tooling: true,
stylistic: true,
},
}).override('nuxt/rules', {
rules: {
'vue/no-v-html': 'off',
'no-useless-escape': 'off',
'vue/multi-word-component-names': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
ignores: ['playground/server'],
})
4 changes: 4 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: ['@nuxt/eslint'],
})
Loading

0 comments on commit 848db66

Please sign in to comment.