Skip to content

Commit

Permalink
Cleanup files published on npm (#19)
Browse files Browse the repository at this point in the history
* cleanup published files

* add changeset

* add MIT license
  • Loading branch information
temoncher authored Sep 9, 2024
1 parent 2e0cee2 commit 8594323
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 171 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-dancers-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-clsx': patch
---

cleanup published files
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Ben Mosher

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.
9 changes: 6 additions & 3 deletions generate-all-rules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-disable @typescript-eslint/no-require-imports */
const fs = require('fs');

const packageJson = require('./package.json');

function camelize(s) {
return s.replace(/-./g, (x) => x[1].toUpperCase());
}
Expand All @@ -16,10 +18,11 @@ const ruleNames = fs
)
.map((fileName) => fileName.replace(/\.ts$/, ''));

const imports = ruleNames.map((name) => `import ${camelize(name)} from './${name}';`).join('\n');
const imports = ruleNames.map((name) => `import ${camelize(name)} from './${name}';`).join('');

const pairs = ruleNames.map((name) => `"${name}": ${camelize(name)}`).join(',\n');
const pairs = ruleNames.map((name) => `"${name}": ${camelize(name)}`).join(',');
const REPO_URL = packageJson.repository.url.replace(/^git\+/, '').replace(/\.git$/, '');

const content = `${imports}\nexport const allRules = {\n${pairs}\n};\n`;
const content = `${imports}\nexport const allRules = {${pairs}};\nexport const REPO_URL="${REPO_URL}"`;

fs.writeFileSync(`${__dirname}/src/rules/allRules.generated.ts`, content);
Loading

0 comments on commit 8594323

Please sign in to comment.