CI: add eslint

Summary:
Signed-off-by: Yongmin Hong <revi@omglol.email>

npm: use @revi/eslint-config

Also change eslint format, and publish `v0.0.2`.
Also prepare for eslint-config-wikimedia when they have eslint9 support.

Signed-off-by: Yongmin Hong <revi@omglol.email>

Test Plan: `npm run eslint`.

Reviewers: O1 revi & automations, revi

Reviewed By: O1 revi & automations, revi

Differential Revision: https://issuetracker.revi.xyz/D332
This commit is contained in:
revi 2024-06-16 15:47:00 +09:00
parent be3db3c067
commit 0f4b7c97e3
Signed by: revi
GPG key ID: 1EB4F6CEEA100E94
6 changed files with 3865 additions and 239 deletions

25
eslint.config.mjs Normal file
View file

@ -0,0 +1,25 @@
//@ts-check
/**
* @file revi/sandbox eslint config
* @see https://eslint.org/docs/latest/use/configure/configuration-files
* @type {import("eslint").Linter.Config}
* @copyright Hong Yongmin 2024
* @license Apache-2.0
*/
import reviConfig from '@revi/eslint-config';
// import wikimedia from 'eslint-config-wikimedia';
export default [
...reviConfig,
// blocked by eslint9 support:
// https://github.com/wikimedia/eslint-config-wikimedia/issues/563
//{
// files: ['wikiassets/*.js'],
// plugins: {wikimedia},
// extends: ['wikimedia/client/es6', 'wikimedia/mediawiki'],
// languageOptions: {
// sourceType: 'script',
// },
//},
];

View file

@ -5,7 +5,11 @@ # @revi/eslint-config
## Config ## Config
```js ```js
const config = [ import globals from 'globals';
import pluginJs from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
export default [
pluginJs.configs.recommended, pluginJs.configs.recommended,
{ {
rules: { rules: {

View file

@ -12,7 +12,7 @@ import globals from 'globals';
import pluginJs from '@eslint/js'; import pluginJs from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier'; import eslintConfigPrettier from 'eslint-config-prettier';
const config = [ export default [
pluginJs.configs.recommended, pluginJs.configs.recommended,
{ {
rules: { rules: {
@ -23,5 +23,3 @@ const config = [
{languageOptions: {globals: globals.browser}}, {languageOptions: {globals: globals.browser}},
eslintConfigPrettier, eslintConfigPrettier,
]; ];
export default config;

View file

@ -1,7 +1,7 @@
{ {
"$schema": "https://json.schemastore.org/package.json", "$schema": "https://json.schemastore.org/package.json",
"name": "@revi/eslint-config", "name": "@revi/eslint-config",
"version": "0.0.1", "version": "0.0.2",
"description": "@revi's shared eslint config", "description": "@revi's shared eslint config",
"main": "eslint.config.js", "main": "eslint.config.js",
"peerDependencies": { "peerDependencies": {
@ -21,6 +21,11 @@
"keywords": [ "keywords": [
"eslint" "eslint"
], ],
"repository": {
"type": "git",
"url": "https://github.com/revi/sandbox.git",
"directory": "npm/eslint-config"
},
"author": { "author": {
"name": "Yongmin Hong", "name": "Yongmin Hong",
"url": "https://revi.xyz/", "url": "https://revi.xyz/",

4058
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,12 +3,16 @@
"name": "@revi/scripts", "name": "@revi/scripts",
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@revi/eslint-config": "^0.0.2",
"@revi/prettier-config": "^0.0.2", "@revi/prettier-config": "^0.0.2",
"csslint": "^1.0.5", "csslint": "^1.0.5",
"eslint": "^9.5.0",
"eslint-config-wikimedia": "^0.28.2",
"jshint": "^2.13.6", "jshint": "^2.13.6",
"prettier": "^3.3.2" "prettier": "^3.3.2"
}, },
"scripts": { "scripts": {
"eslint": "eslint",
"p:c": "prettier --check", "p:c": "prettier --check",
"p:w": "prettier --write" "p:w": "prettier --write"
}, },