Skip to content

Commit

Permalink
bump all deps to latest version including svelte 5, marked 15 and esl…
Browse files Browse the repository at this point in the history
…int 9 with flat config upgrade.
  • Loading branch information
ildella committed Nov 11, 2024
1 parent f95fe39 commit 89d6ace
Show file tree
Hide file tree
Showing 8 changed files with 710 additions and 594 deletions.
48 changes: 0 additions & 48 deletions .eslintrc.js

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

40 changes: 40 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import globals from "globals"
import pluginJs from "@eslint/js"
import svelteParser from 'svelte-eslint-parser'
import sveltePlugin from 'eslint-plugin-svelte'

export default [
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
{
name: 'Frankie WebApp',
ignores: [
'vite.config.js.*',
'more.eslint.config.js',
],
},
{
name: 'Svelte files',
files: [
'src/**/*.svelte',
'src/routes/**/*page.js',
'src/routes/**/*layout.js',
],
languageOptions: {
parser: svelteParser,
globals: {...globals.browser},
},
plugins: {
// '@stylistic/js': stylisticJs,
svelte: sveltePlugin,
},
rules: {
// ...pluginJs.configs.recommended.rules,
// ...recommended.rules,
// '@stylistic/js/max-len': ['warn', {code: 250}],
'no-undefined': 'off',
'svelte/no-at-html-tags': 'off',
'svelte/valid-compile': 'off',
},
},
]
110 changes: 110 additions & 0 deletions more.eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
const globals = require('globals')
const js = require('@eslint/js')
const stylisticJs = require('@stylistic/eslint-plugin-js')
const eslintPluginSvelte = require('eslint-plugin-svelte')
const svelteEslintParser = require('svelte-eslint-parser')
const vitest = require('eslint-plugin-vitest')

const rules = {
semi: ['warn', 'never'],
quotes: ['error', 'single'],
'dot-location': ['warn', 'property'],
'guard-for-in': ['warn'],
'no-multi-spaces': ['warn'],
yoda: ['warn', 'never'],
camelcase: ['error'],
'comma-style': ['warn'],
'comma-dangle': ['warn', 'always-multiline'],
'block-spacing': ['warn'],
'keyword-spacing': ['warn'],
'no-trailing-spaces': ['warn'],
'no-unneeded-ternary': ['warn'],
'no-whitespace-before-property': ['warn'],
'object-curly-spacing': ['warn', 'always'],
'space-before-blocks': ['warn'],
'space-in-parens': ['warn'],
'arrow-spacing': ['warn'],
'no-duplicate-imports': ['error'],
'no-var': ['error'],
'prefer-const': ['warn'],
'no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
}


const [sveltePlugin, recommended] = eslintPluginSvelte.configs['flat/recommended']
const {svelte} = sveltePlugin.plugins

const config = [
{
name: 'Svelte Marked',
// ignores: webappIgnores,
},
{
name: 'Pure javascript files',
files: [
'src/**/*.js',
'tests/**/*.js',
'e2e/**/*.*js',
'*.cjs',
'*.config.js',
'*.config.cjs',
],
languageOptions: {
sourceType: 'module',
},
plugins: {
'@stylistic/js': stylisticJs,
// security,
},
rules: {
...js.configs.recommended.rules,
'@stylistic/js/object-curly-newline': ['warn', {
multiline: true,
// 'consistent': true,
minProperties: 5,
}],
'@stylistic/js/max-len': ['warn', {code: 250}],
'no-undefined': 'warn',
},
},
{
name: 'Svelte files',
files: [
'src/**/*.svelte',
'src/routes/**/*page.js',
'src/routes/**/*layout.js',
],
languageOptions: {
parser: svelteEslintParser,
globals: {...globals.browser},
},
plugins: {
'@stylistic/js': stylisticJs,
svelte,
},
rules: {
...js.configs.recommended.rules,
...recommended.rules,
camelcase,
'@stylistic/js/max-len': ['warn', {code: 250}],
'no-undefined': 'warn',
'svelte/no-at-html-tags': 'off',
'svelte/valid-compile': 'off',
},
},
{
files: ['tests/**/*.js'],
plugins: {vitest},
rules: {
...vitest.configs.recommended.rules,
'vitest/max-nested-describe': ['error', {max: 3}],
'sonarjs/slow-regex': 'off',
},
},
]
33 changes: 19 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "svelte-marked",
"description": "A markdown renderer for Svelte.",
"version": "0.5.7",
"packageManager": "yarn@4.4.0",
"version": "0.6.0",
"packageManager": "yarn@4.5.1",
"engines": {
"node": ">=18"
},
Expand Down Expand Up @@ -33,30 +33,35 @@
"scripts": {
"build": "vite build",
"dev": "vite build --watch",
"lint": "eslint . --max-warnings 2",
"test": "vitest run",
"test:watch": "vitest watch"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "3.1.2",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/svelte": "5.2.1",
"eslint": "9.10.0",
"eslint-plugin-svelte": "2.44.0",
"jsdom": "25.0.0",
"@eslint/js": "9.14.0",
"@stylistic/eslint-plugin-js": "2.10.1",
"@sveltejs/vite-plugin-svelte": "4.0.0",
"@testing-library/jest-dom": "6.6.3",
"@testing-library/svelte": "5.2.4",
"eslint": "9.14.0",
"eslint-plugin-svelte": "2.46.0",
"eslint-plugin-vitest": "0.5.4",
"globals": "15.12.0",
"jsdom": "25.0.1",
"prettier": "3.3.3",
"rollup-plugin-analyzer": "4.0.0",
"rollup-plugin-filesize": "10.0.0",
"rollup-plugin-terser": "7.0.2",
"sirv-cli": "2.0.2",
"svelte": "4.2.19",
"svelte-eslint-parser": "0.41.1",
"vite": "5.4.6",
"vitest": "2.1.1"
"sirv-cli": "3.0.0",
"svelte": "5.1.14",
"svelte-eslint-parser": "0.43.0",
"vite": "5.4.11",
"vitest": "2.1.4"
},
"dependencies": {
"@types/marked": "6.0.0",
"github-slugger": "2.0.0",
"marked": "14.1.2"
"marked": "15.0.0"
},
"peerDependencies": {
"svelte": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/svelte-markdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('testing initialization', () => {
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.`,
})

const element = screen.getByText('example')
// const element = screen.getByText('Contrary')
// expect(element).toBeInTheDocument()
// expect(element).toContainHTML('<strong>example</strong>')
})
Expand Down
21 changes: 11 additions & 10 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import analyze from 'rollup-plugin-analyzer'
import { terser } from 'rollup-plugin-terser'
import filesize from 'rollup-plugin-filesize'
// import analyze from 'rollup-plugin-analyzer'
// import { terser } from 'rollup-plugin-terser'
// import filesize from 'rollup-plugin-filesize'
import pkg from './package.json'

const production = !process.argv.includes('--watch')
// const production = !process.argv.includes('--watch')
const removeDist = (p) => p.replace('dist/', '')

export default defineConfig({
plugins: [svelte({ hot: !process.env.VITEST })],
// plugins: [svelte({ hot: !process.env.VITEST })],
plugins: [svelte()],
test: {
globals: true,
environment: 'jsdom',
},
build: {
rollupOptions: {
input: 'src/index.js',
plugins: [
production && terser(),
production && analyze(),
production && filesize(),
],
// plugins: [
// production && terser(),
// production && analyze(),
// production && filesize(),
// ],
},
sourcemap: true,
lib: {
Expand Down
Loading

0 comments on commit 89d6ace

Please sign in to comment.