Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
eslint-plugin-smarthr
Advanced tools
{
rules: {
'smarthr/a11y-icon-button-has-name': 'error', // 'warn', 'off'
},
}
<XxxButton>
<YyyIcon />
</XxxButton>
<XxxButton>
<YyyIcon />
Hoge
</XxxButton>
<XxxButton>
<YyyIcon />
<AnyComponent />
</XxxButton>
<XxxButton>
<YyyIcon visuallyHiddenText="hoge" />
</XxxButton>
--fix
オプション付きで実行すると自動的にパスを置き換えます/ constants
/ modules // 全体共通ディレクトリ
/ crews
/ modules // 共通ディレクトリ
/ views
/ parts
/ index
/ adapters
/ index.ts
/ hoge.ts
/ slices
/ index.ts
/ views
/ index.ts
/ parts
/ Abc.ts
/ show
/ views
/ parts
const DOMAIN_RULE_ARGS = {
globalModuleDir: [ './constants', './modules' ],
domainModuleDir: [ 'modules' ],
domainConstituteDir: [ 'adapters', 'slices', 'views', 'parts' ],
}
{
rules: {
'smarthr/format-import-path': [
'error', // 'warn', 'off'
{
...DOMAIN_RULE_ARGS,
format: {
// 'relative', 'auto', 'none'
// all: 'absolute',
outside: 'auto',
globalModule: 'absolute',
module: 'relative',
domain: 'relative',
lower: 'relative',
},
},
],
},
}
// crews/index/views/index.js
import slice from '@/crews/index/slice'
import hoge from '@/crews/index/adapter/hoge'
import Abc from '@/crews/index/views/parts/Abc'
import modulePart from '@/crews/modules/views/part'
import showPart from '../../show/views/parts'
import globalModulePart from '../../../module/views/part'
// crews/index/views/index.js
import slice from '../slice'
import hoge from '../adapter/hoge'
import Abc from './parts/Abc'
import modulePart from '../../modules/views/parts'
import showPart from '@/crews/show/views/parts'
import globalModulePart from '@/modules/views/parts'
{
rules: {
'smarthr/jsx-start-with-spread-attributes': 'error', // 'warn', 'off'
},
}
<AnyComponent hoge="hoge" {...props} />
<AnyComponent {...props} hoge="hoge" />
/ constants
/ modules // 全体共通ディレクトリ
/ crews
/ modules // 共通ディレクトリ
/ views
/ parts
/ index
/ adapters
/ index.ts
/ hoge.ts
/ slices
/ index.ts
/ views
/ index.ts
/ parts
/ Abc.ts
/ show
/ views
/ parts
const DOMAIN_RULE_ARGS = {
globalModuleDir: [ './constants', './modules' ],
domainModuleDir: [ 'modules' ],
domainConstituteDir: [ 'adapters', 'slices', 'views', 'parts' ],
}
{
rules: {
'smarthr/no-import-other-domain': [
'error', // 'warn', 'off'
{
...DOMAIN_RULE_ARGS,
// analyticsMode: 'all', // 'same-domain', 'another-domain'
}
]
},
}
// crews/index/views/index.js
import showPart1 from '@/crews/show/views/parts'
import showPart2 from '../../show/views/parts'
// crews/index/views/index.js
import slice from '../slice'
import hoge from '../adapter/hoge'
import Abc from './parts/Abc'
import modulePart from '../../modules/views/parts'
import globalModulePart from '@/modules/views/parts'
{
rules: {
'smarthr/prohibit-import': [
'error', // 'warn', 'off'
{
targets: {
'^query-string$': true, // key は 正規表現を指定する
'^smarthr-ui$': ['SecondaryButtonAnchor'],
},
// generateReportMessage: (source, imported) =>
// `${source}${imported && `/${imported}`} はXxxxxxなので利用せず yyyy/zzzz を利用してください`
}
]
},
}
import queryString from 'query-string'
import { SecondaryButtonAnchor } from 'smarthr-ui'
import { PrimaryButton, SecondaryButton } from 'smarthr-ui'
const ignorekeywords = ['views', 'parts']
const keywordGenerator = ({ keywords }) => (
keywords.reduce((prev, keyword, index) => {
switch (keyword) {
case 'repositories':
return [...prev, keyword, 'repository']
}
const replacedKeyword = keyword.replace(/(repository|s)$/, '')
if (keyword !== replacedKeyword) {
return [...prev, keyword, replacedKeyword]
}
return [...prev, keyword]
}, [])
)
// 例: actions 以下の場合だけ 'Action' もしくは `Actions` のSuffixを許可する
const suffixGenerator = ({ node, filename }) => {
let suffix = ['Props', 'Type']
if (filename.match(/\/actions\//)) {
suffix = [
isUnionType || (node.typeAnnotation.type === 'TSTypeReference' && node.id.name.match(/Actions$/))
? 'Actions'
: 'Action',
...suffix,
]
}
}
@/crews/index/views/page.tsx
の場合
['crews', 'crew', 'index', 'page']
@/crews/index/views/parts/Abc.tsx
の場合
['crews', 'crew', 'index', 'Abc']
@/crews/index/repositories/index.ts
の場合
['crews', 'crew', 'index', 'repositories', 'repository']
{
rules: {
'smarthr/redundant-name': [
'error', // 'warn', 'off'
{
type: { ignorekeywords, keywordGenerator, suffixGenerator },
file: { ignorekeywords, keywordGenerator },
// property: { ignorekeywords, keywordGenerator },
// function: { ignorekeywords, keywordGenerator },
// variable: { ignorekeywords, keywordGenerator },
// class: { ignorekeywords, keywordGenerator },
}
]
},
}
// @/crews/index/views/page.tsx
type CrewIndexPage = { hoge: string }
type CrewsView = { hoge: string }
// @/crews/show/repositories/index.tsx
type CrewIndexRepository = { hoge: () => any }
// @/crews/index/views/page.tsx
type ItemProps = { hoge: string }
// @/crews/show/repositories/index.tsx
type IndexProps = { hoge: () => any }
type ResponseType = { hoge: () => any }
``
0.0.0 (2022-01-25)
FAQs
A sharable ESLint plugin for SmartHR
The npm package eslint-plugin-smarthr receives a total of 6,180 weekly downloads. As such, eslint-plugin-smarthr popularity was classified as popular.
We found that eslint-plugin-smarthr demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.