Skip to content

Commit

Permalink
feat: add consistent-attribute-lines and brackets-same-line rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-8 committed Sep 29, 2023
0 parents commit ea6654c
Show file tree
Hide file tree
Showing 47 changed files with 7,801 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Setup
run: npm i -g @antfu/ni

- name: Install
run: nci

- name: Lint
run: nr lint

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Setup
run: npm i -g @antfu/ni

- name: Install
run: nci

- name: Typecheck
run: nr typecheck

test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node: [16.x, 18.x]
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Setup
run: npm i -g @antfu/ni

- name: Install
run: nci

- name: Build
run: nr build

- name: Test
run: nr test
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Set node
uses: actions/setup-node@v3
with:
node-version: 18.x

- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.cache
.DS_Store
.idea
*.log
*.tgz
coverage
dist
lib-cov
logs
node_modules
temp
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore-workspace-root-check=true
shamefully-hoist=true
39 changes: 39 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
// Enable the flat config support
"eslint.experimental.useFlatConfig": true,

// Disable the default formatter
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": false
},

// Silent the stylistic rules in you IDE, but still auto fix them
// "eslint.rules.customizations": [
// { "rule": "@stylistic/*", "severity": "warn" },
// { "rule": "style*", "severity": "warn" },
// { "rule": "*-indent", "severity": "warn" },
// { "rule": "*-spacing", "severity": "warn" },
// { "rule": "*-spaces", "severity": "warn" },
// { "rule": "*-order", "severity": "warn" },
// { "rule": "*-dangle", "severity": "warn" },
// { "rule": "*-newline", "severity": "warn" },
// { "rule": "*quotes", "severity": "warn" },
// { "rule": "*semi", "severity": "warn" }
// ],

"eslint.validate": [
"javascript",
"typescript",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"svelte"
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023-PRESENT Jacob Bowdoin <https://github.com/jacob-8>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# eslint-plugin-svelte-stylistic

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]

[Rules List](./src/index.ts)

## Source & Inspiration

This repo was forked from [eslint-plugin-antfu](https://github.com/antfu/eslint-plugin-antfu), and he taught me (and wrote with me) my first two ESLint rules. I am very grateful for his help and for his work on the original repo. I don't know how to give proper License attribution yet, but I think this is clear enough to start. So yeah, learn [ESLint's Flat Config](https://eslint.org/docs/latest/use/configure/configuration-files-new) and give Anthony's [eslint-config](https://github.com/antfu/eslint-config) a try.

[![code style](https://antfu.me/badge-code-style.svg)](https://github.com/antfu/eslint-config)

## License

[MIT](./LICENSE) License © 2023-PRESENT [Jacob Bowdoin](https://github.com/jacob-8)

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/eslint-plugin-svelte-stylistic?style=flat&colorA=080f12&colorB=1fa669
[npm-version-href]: https://npmjs.com/package/eslint-plugin-svelte-stylistic
[npm-downloads-src]: https://img.shields.io/npm/dm/eslint-plugin-svelte-stylistic?style=flat&colorA=080f12&colorB=1fa669
[npm-downloads-href]: https://npmjs.com/package/eslint-plugin-svelte-stylistic
12 changes: 12 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
'src/index',
],
declaration: false,
clean: true,
rollup: {
emitCJS: true,
},
})
23 changes: 23 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import antfu from '@antfu/eslint-config'
import svelteStylistic from './dist/index.mjs'
import { svelte } from './svelte-eslint.js'

const newRules = {
files: ['demo/*.svelte'],
plugins: {
'svelte-stylistic': svelteStylistic,
},
rules: {
'svelte-stylistic/svelte-jacob-rule': 'error',
'svelte-stylistic/svelte-brackets-rule': 'error',
},
}

export default antfu(
{},
{
ignores: ['vendor'],
},
newRules,
svelte,
)
79 changes: 79 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "eslint-plugin-svelte-stylistic",
"type": "module",
"version": "0.0.1",
"packageManager": "pnpm@8.7.6",
"description": "More Svelte Formatting rules",
"author": "Jacob Bowdoin",
"license": "MIT",
"homepage": "https://github.com/jacob-8/eslint-plugin-svelte-stylistic#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/jacob-8/eslint-plugin-svelte-stylistic.git"
},
"bugs": "https://github.com/jacob-8/eslint-plugin-svelte-stylistic/issues",
"keywords": [],
"sideEffects": false,
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"files": [
"dist"
],
"scripts": {
"build": "unbuild",
"dev": "unbuild --stub",
"lint": "pnpm run dev && eslint .",
"prepublishOnly": "nr build",
"release": "bumpp && npm publish",
"start": "esno src/index.ts",
"test": "vitest",
"typecheck": "tsc --noEmit",
"prepare": "simple-git-hooks"
},
"dependencies": {
"@typescript-eslint/utils": "^6.7.2"
},
"devDependencies": {
"@antfu/eslint-config": "^1.0.0-beta.4",
"@antfu/ni": "^0.21.8",
"@antfu/utils": "^0.7.6",
"@types/eslint": "^8.44.2",
"@types/lodash.merge": "^4.6.7",
"@types/node": "^20.6.3",
"@types/semver": "^7.5.2",
"@typescript-eslint/parser": "^6.7.3",
"@typescript-eslint/rule-tester": "^6.7.2",
"@typescript-eslint/typescript-estree": "6.7.2",
"@typescript-eslint/utils": "6.7.2",
"ajv": "^6.10.0",
"bumpp": "^9.2.0",
"eslint": "^8.50.0",
"eslint-define-config": "^1.23.0",
"eslint-plugin-svelte": "^2.33.2",
"esno": "^0.17.0",
"lint-staged": "^14.0.1",
"lodash.merge": "4.6.2",
"pnpm": "^8.7.6",
"rimraf": "^5.0.1",
"semver": "^7.5.4",
"simple-git-hooks": "^2.9.0",
"svelte": "^4.2.1",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"vite": "^4.4.9",
"vitest": "^0.34.5"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}
Loading

0 comments on commit ea6654c

Please sign in to comment.