Skip to content

Commit

Permalink
eslint upgrade base
Browse files Browse the repository at this point in the history
  • Loading branch information
jekuer committed Sep 30, 2024
1 parent 89bde6c commit 1b97d0d
Show file tree
Hide file tree
Showing 15 changed files with 339 additions and 499 deletions.
36 changes: 0 additions & 36 deletions .eslintrc.json

This file was deleted.

6 changes: 3 additions & 3 deletions prettier.config.js → .prettierrc.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable no-undef */
// prettier.config.js or .prettierrc.js
module.exports = {
/** @type {import("prettier").Config} */
export default {
proseWrap: 'preserve',
embeddedLanguageFormatting: 'off',
useTabs: false,
singleQuote: true,
trailingComma: 'all',
arrowParens: 'always',
printWidth: 300,
endOfLine: 'lf',
Expand Down
15 changes: 4 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module.exports = function (grunt) {
dest: 'dist/commonjs/index.js',
options: {
stripBanners: true,
banner: "// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nconst tzlibActions = require('timezones-ical-library');\r\n",
banner: "const tzlibActions = require('timezones-ical-library');\r\n",
footer: 'module.exports = { atcb_action, i18nStrings, cssStyles: atcbCssTemplate, atcb_generate_ty, atcb_generate_timestring };',
process: (content) => prepareFinalFile(content, true, true, true),
},
Expand All @@ -208,7 +208,7 @@ module.exports = function (grunt) {
dest: 'dist/commonjs/no-pro/index.js',
options: {
stripBanners: true,
banner: "// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nconst tzlibActions = require('timezones-ical-library');\r\n",
banner: "const tzlibActions = require('timezones-ical-library');\r\n",
footer: 'module.exports = { atcb_action, i18nStrings, cssStyles: atcbCssTemplate };',
process: (content) => prepareFinalFile(content, true, true, true),
},
Expand All @@ -218,7 +218,7 @@ module.exports = function (grunt) {
dest: 'dist/commonjs/unstyle/index.js',
options: {
stripBanners: true,
banner: "// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nconst tzlibActions = require('timezones-ical-library');\r\n",
banner: "const tzlibActions = require('timezones-ical-library');\r\n",
footer: 'module.exports = { atcb_action, i18nStrings, atcb_generate_ty, atcb_generate_timestring };',
process: (content) => prepareFinalFile(content, true, true, true, true),
},
Expand All @@ -228,7 +228,7 @@ module.exports = function (grunt) {
dest: 'dist/commonjs/no-pro-unstyle/index.js',
options: {
stripBanners: true,
banner: "// eslint-disable-next-line @typescript-eslint/no-var-requires\r\nconst tzlibActions = require('timezones-ical-library');\r\n",
banner: "const tzlibActions = require('timezones-ical-library');\r\n",
footer: 'module.exports = { atcb_action, i18nStrings };',
process: (content) => prepareFinalFile(content, true, true, true, true),
},
Expand All @@ -255,12 +255,6 @@ module.exports = function (grunt) {
done();
},
},
'.eslintrc.json commonJS': {
'dist/commonjs/.eslintrc.json': function (fs, fd, done) {
fs.writeSync(fd, '{ "extends": "../../.eslintrc.json", "env": { "node": true }, "plugins": ["commonjs"] }');
done();
},
},
},
// minify js files
uglify: {
Expand All @@ -269,7 +263,6 @@ module.exports = function (grunt) {
mangle: true,
beautify: false,
sourceMap: false,
banner: '/* eslint-disable @typescript-eslint/no-unused-vars */',
output: {
comments: 'some',
},
Expand Down
32 changes: 32 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import js from '@eslint/js';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import regexpEslint from 'eslint-plugin-regexp';
import wcEslint from 'eslint-plugin-wc';

export default [
// general ignores
{
ignores: ['**/*.d.ts', '**/*.min.*', 'dist/*', 'demo/*', 'Gruntfile.js', 'set-release.js', 'node_modules/', '.github/'],
},
// general rules
js.configs.recommended,
regexpEslint.configs['flat/recommended'],
wcEslint.configs['flat/recommended'],
prettierRecommended,
// overrides
{
files: ['**/*.{js,mjs,cjs}'],
rules: {
'prettier/prettier': 'error',
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
'no-undef': 'off',
'no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
},
],
},
},
];
Loading

0 comments on commit 1b97d0d

Please sign in to comment.